Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created October 15, 2016 14:45
Show Gist options
  • Select an option

  • Save hugodias/9fd3372f713a1f3ed7ef04748d14a17b to your computer and use it in GitHub Desktop.

Select an option

Save hugodias/9fd3372f713a1f3ed7ef04748d14a17b to your computer and use it in GitHub Desktop.
class Dropbox
constructor: ->
@options =
success: @success
cancel: ->
# Do something
linkType: 'direct'
multiselect: true
extensions: [
'.jpg'
'.png'
'.gif'
]
@bind()
bind: ->
$(document).on 'click', '#dropbox', =>
window.Dropbox.choose(@options)
success: (files) =>
@upload file.link for file in files
upload: (file_path) ->
$.post("/pictures",
remote_image_url: file_path
).done (picture) ->
console.log picture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment