42 lines
1.2 KiB
CoffeeScript
42 lines
1.2 KiB
CoffeeScript
|
|
context = window
|
||
|
|
rest = context.JK.Rest()
|
||
|
|
logger = context.JK.logger
|
||
|
|
|
||
|
|
AttachmentStore = context.AttachmentStore
|
||
|
|
|
||
|
|
@AttachmentStatus = React.createClass({
|
||
|
|
|
||
|
|
mixins: [
|
||
|
|
Reflux.listenTo(AttachmentStore, "onAttachmentStore"),
|
||
|
|
]
|
||
|
|
|
||
|
|
onAttachmentStore: (attachmentState) ->
|
||
|
|
|
||
|
|
componentDidMount: () ->
|
||
|
|
@root = $(@getDOMNode())
|
||
|
|
@attachmentNotation = @root.find('.attachment-notation')
|
||
|
|
@attachmentAudio = @root.find('.attachment-audio')
|
||
|
|
|
||
|
|
notationSelected: (e) ->
|
||
|
|
files = $(e.target).get(0).files
|
||
|
|
logger.debug("notation files selected: " + files)
|
||
|
|
window.AttachmentActions.uploadNotations(files)
|
||
|
|
|
||
|
|
audioSelected: (e) ->
|
||
|
|
files = $(e.target).get(0).files
|
||
|
|
logger.debug("audio files selected: " + files)
|
||
|
|
|
||
|
|
render: () ->
|
||
|
|
`<div className="attachment-status">
|
||
|
|
|
||
|
|
<form className="hidden">
|
||
|
|
<input type="file" className="hidden attachment-notation" value="" onChange={this.notationSelected}
|
||
|
|
accept=".pdf, .png, .jpg, .jpeg, .gif, .xml, .mxl, .txt" multiple/>
|
||
|
|
<input type="file" className="hidden attachment-audio" value="" onChange={this.audioSelected}
|
||
|
|
accept=".wav, .flac, .ogg, .aiff, .aifc, .au" multiple/>
|
||
|
|
</form>
|
||
|
|
</div>`
|
||
|
|
|
||
|
|
})
|
||
|
|
|