context = window

@MusicNotationUploadDialog = React.createClass({

  mixins: [Reflux.listenTo(@AppStore, "onAppInit"),  Reflux.listenTo(AttachmentStore, "onAttachmentStore")]

  getInitialState: () ->
    {
      uploading: false
    }
  onAppInit: (@app) ->

  onAttachmentStore: (attachmentState) ->
    @setState(attachmentState)

  handleCloseMessage: (e) ->
    e.preventDefault()

    @app.layout.closeDialog('music-notation-upload-dialog')

  render: () ->

    if @state.uploading
      state =
        `<div>
          <h3>Please wait while we upload your attachment to the lesson...</h3>
          <div className="spinner spinner-large"></div>
        </div>`
    else
      state =
        `<div>
          <h3>Your file has been uploaded.</h3>
        </div>`

    `<div className="MusicNotationUploadDialog">
      <div className="content-head">
        <img className="content-icon" src="/assets/content/icon_add.png" height={19} width={19}/>

        <h1>Uploading Attachment</h1>
      </div>
      <div className="dialog-inner">
        {state}
        <div className="actions">
            <a className="button-orange " onClick={this.handleCloseMessage}>CLOSE</a>
        </div>
      </div>
    </div>`
})

