Skip to content

Instantly share code, notes, and snippets.

@spencerfdavis
Created May 15, 2014 18:23
Show Gist options
  • Save spencerfdavis/941a4b9444ac0075c61c to your computer and use it in GitHub Desktop.
Save spencerfdavis/941a4b9444ac0075c61c to your computer and use it in GitHub Desktop.
require ['media-uploader'], (MediaUploader) ->
class Rise.Views.Teach.Lessons.UploadContentModal extends MediaUploader.UploadModal
el: '#upload-modal'
FILE_TYPES:
'Content::Document': ['pdf']
'Content::Media': ['video', 'audio']
initialize: ->
setDefaults()
super
onFileUploaded: (data) =>
@model.set
content_type: "Content::Video"
content_icon_class: "icon-video"
content_attributes:
url: data.url
filename: "test.mp4"
@model.save()
super
setDefaults: ->
@options.fileUploadTypes = @FILE_TYPES[@model.get('content_type')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment