 
   getInitialState: ->
     course_name: @props.course.name
+    showModal: false
+
+  close: ->
+    @setState({showModal: false})
+
+  open: ->
+    @setState({showModal: true})
 
   validate: (name) ->
     error = CourseStore.validateCourseName(name, @props.course.name)

    unless @state.invalid
      CourseActions.save(@props.courseId, course: {name: @state.course_name})
      CourseStore.once 'saved', ->
        @refs.overlay.hide()

  renderForm: ->
    formClasses = classnames 'modal-body', 'teacher-edit-course-form', 'is-invalid-form': @state?.invalid

    </BS.Modal>

  render: ->
    <span>
      <BS.Button onClick={@open} bsStyle='link' className='edit-course'>
        <i className='fa fa-pencil' /> Rename Course
      </BS.Button>
      {@renderForm()}
    </span>

module.exports = RenameCourse
