Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cadwallion/f6b67ff9721161878b3a to your computer and use it in GitHub Desktop.
Save cadwallion/f6b67ff9721161878b3a 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) =>
@lesson.set
content_type: "Content::Video"
content_icon_class: "icon-video"
content_attributes:
url: data.url
filename: "test.mp4"
@lesson.save()
super
setDefaults: ->
@lesson = @options.lesson
@fileUploadTypes = @FILE_TYPES[@lesson.get('content_type')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment