     ExerciseActions.loaded(template, id)
     @setState({exerciseId: id })
 
-  loadExercise: ->
-    exerciseId = @props.exerciseId or this.refs.exerciseId.getDOMNode().value
+  loadExercise: (exerciseId) ->
     @setState({exerciseId})
     ExerciseActions.load(exerciseId)
 
+  onFindExercise: ->
+    @loadExercise(this.refs.exerciseId.getDOMNode().value)
+
   onFindKeyPress: (ev) ->
     return unless ev.key is 'Enter'
-    @loadExercise()
+    @loadExercise(this.refs.exerciseId.getDOMNode().value)
     ev.preventDefault()
 
   renderExerciseOrLoad: ->

        <input type="text" className="form-control" onKeyPress={@onFindKeyPress}
          ref="exerciseId" placeholder="Exercise ID"/>
        <span className="input-group-btn">
          <button className="btn btn-default" type="button" onClick={@loadExercise}>Load</button>
        </span>
      </div>


    if @props.exerciseId is 'new'
      @addNew()
    else if @props.exerciseId
      @loadExercise(@props.exerciseId)

  publishExercise: ->
    if confirm('Are you sure you want to publish?')
      ExerciseActions.save(@state.exerciseId)
      ExerciseActions.publish(@state.exerciseId)


  addNew: ->
    id = ExerciseStore.freshLocalId()
