<commit_before>React = require 'react'
BS = require 'react-bootstrap'

classnames = require 'classnames'
keys = require 'lodash/keys'

BindStore = require '../bind-store-mixin'
{NewCourseActions, NewCourseStore} = require '../../flux/new-course'

STAGES = {
  'course_type': require './select-type'
  'course_code': require './select-course'
  'period':      require './select-dates'
  'details':     require './course-details'
  'all':         require './build-course'
}

STAGE_KEYS = keys(STAGES)

NewCourse = React.createClass

  getInitialState: ->
    currentStage: 0

  contextTypes:
    router: React.PropTypes.object

  mixins: [BindStore]
  bindStore: NewCourseStore

  onContinue: ->
    @setState({currentStage: @state.currentStage + 1})

  onBack: ->
    @setState({currentStage: @state.currentStage - 1})

  Footer: ->
    <div className="controls">
      <BS.Button onClick={@onBack}
        bsStyle='success' className="back"
        disabled={@state.currentStage is 0}
      >
        Back
      </BS.Button>

      <BS.Button onClick={@onContinue}
        bsStyle='success' className="next"
        disabled={
          not NewCourseStore.isValid( STAGE_KEYS[@state.currentStage] )
        }
      >
        Continue
      </BS.Button>

      <BS.Button
        onClick={@onCancel} className="cancel"
      >
        Cancel
      </BS.Button>
    </div>

  onCancel: ->
    @context.router.transitionTo('/dashboard')

  render: ->
    Component = STAGES[ STAGE_KEYS[ @state.currentStage ] ]

    <div className="new-course">
      <BS.Panel
        header={Component.title}
        className={@state.currentStage}
        footer={<@Footer />}
      >
          <Component
            onContinue={@onContinue}
            onCancel={@onCancel}
            {...@state}
          />
      </BS.Panel>
    </div>



module.exports = NewCourse
<commit_msg>swap cancel & back button<commit_after>React = require 'react'
BS = require 'react-bootstrap'

classnames = require 'classnames'
keys = require 'lodash/keys'

BindStore = require '../bind-store-mixin'
{NewCourseActions, NewCourseStore} = require '../../flux/new-course'

STAGES = {
  'course_type': require './select-type'
  'course_code': require './select-course'
  'period':      require './select-dates'
  'details':     require './course-details'
  'all':         require './build-course'
}

STAGE_KEYS = keys(STAGES)

NewCourse = React.createClass

  getInitialState: ->
    currentStage: 0

  contextTypes:
    router: React.PropTypes.object

  mixins: [BindStore]
  bindStore: NewCourseStore

  onContinue: ->
    @setState({currentStage: @state.currentStage + 1})

  onBack: ->
    @setState({currentStage: @state.currentStage - 1})

  Footer: ->
    <div className="controls">
      <BS.Button
        onClick={@onCancel} className="cancel"
      >
        Cancel
      </BS.Button>

      <BS.Button onClick={@onBack}
        bsStyle='success' className="back"
        disabled={@state.currentStage is 0}
      >
        Back
      </BS.Button>

      <BS.Button onClick={@onContinue}
        bsStyle='success' className="next"
        disabled={
          not NewCourseStore.isValid( STAGE_KEYS[@state.currentStage] )
        }
      >
        Continue
      </BS.Button>

    </div>

  onCancel: ->
    @context.router.transitionTo('/dashboard')

  render: ->
    Component = STAGES[ STAGE_KEYS[ @state.currentStage ] ]

    <div className="new-course">
      <BS.Panel
        header={Component.title}
        className={@state.currentStage}
        footer={<@Footer />}
      >
          <Component
            onContinue={@onContinue}
            onCancel={@onCancel}
            {...@state}
          />
      </BS.Panel>
    </div>



module.exports = NewCourse

{'fraction_non_alphanumeric': 0.1438484120629837, 'fraction_numerical': 0.0021350413664264745, 'mean_word_length': 2.4072727272727272, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6529580', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1144, 'n_words': 215}