Sha256: 4248e742568a5859c657b9c041741ce708380434ee94ac7bfacb2b242adde191

Contents?: true

Size: 1.56 KB

Versions: 58

Compression:

Stored size: 1.56 KB

Contents

pageflow.ConfirmUploadView = Backbone.Marionette.Layout.extend({
  template: 'templates/confirm_upload',
  className: 'confirm_upload editor dialog',

  mixins: [pageflow.dialogView],

  regions: {
    selectedFileRegion: '.selected_file_region'
  },

  ui: {
    filesPanel: '.files_panel',
  },

  events: {
    'click .upload': function() {
      this.options.fileUploader.submit();
      this.close();
    }
  },

  initialize: function() {
    this.selection = new Backbone.Model();
    this.listenTo(this.selection, 'change', this.update);
  },

  onRender: function() {
    this.options.fileTypes.each(function(fileType) {
      this.ui.filesPanel.append(this.subview(new pageflow.UploadableFilesView({
        collection: this.options.files[fileType.collectionName],
        fileType: fileType,
        selection: this.selection
      })).el);
    }, this);

    this.update();
  },

  onClose: function() {
    this.options.fileUploader.abort();
  },

  update: function() {
    var file = this.selection.get('file');

    if (file) {
      this.selectedFileRegion.show(new pageflow.EditFileView({
        model: file
      }));
    }
    else {
      this.selectedFileRegion.close();
    }
  }
});

pageflow.ConfirmUploadView.watch = function(fileUploader, fileTypes, files) {
  fileUploader.on('new:batch', function() {
    pageflow.ConfirmUploadView.open({
      fileUploader: fileUploader,
      fileTypes: fileTypes,
      files: files
    });
  });
};

pageflow.ConfirmUploadView.open = function(options) {
  pageflow.app.dialogRegion.show(new pageflow.ConfirmUploadView(options));
};

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.2 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.5.1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.5.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.4.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.3.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.2.1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.2.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.1.1 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.1.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.0.0 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js