Skip to content

Instantly share code, notes, and snippets.

@milushov
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milushov/604f15ba96cea53b218a to your computer and use it in GitHub Desktop.
Save milushov/604f15ba96cea53b218a to your computer and use it in GitHub Desktop.
@milushov
Copy link
Author

SirTrevor.Blocks.Gallery = (function() {
  return SirTrevor.Block.extend({
    _initialized: false,
    initializeUploader: function() {
      if (this._initialized) {
        return;
      }
      this.uploader = this.getTextBlock().find('@uploader');
      this.uploader.fileupload(((function() {
        debugger;
        return {
          url: '/photos.json',
          type: 'PATCH',
          dataType: 'json',
          done: function(e, data) {
            return console.info(data);
          },
          formData: (function(_this) {
            return function() {
              debugger;
            };
          })(this)
        };
      }).bind(this))());
      return this._initialized = true;
    }
  });
})();

@milushov
Copy link
Author

так нужно делать:

      @uploader = @getTextBlock().find('@uploader')

      @uploader.fileupload
        url: '/photos.json'
        type: 'PATCH'
        dataType: 'json'
        done: (e, data) ->
          console.info(data)

      @uploader.bind 'fileuploadsubmit', ((trevor) -> (e, data) ->
        data.formData = { gallery_key: trevor.galleryId() }
      )(@)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment