Sha256: 4fc8e1a30be5a6f7acd9947bdad9a0406134a5ce4e8bd0b872bfd0355dd4051f

Contents?: true

Size: 1.52 KB

Versions: 58

Compression:

Stored size: 1.52 KB

Contents

pageflow.UploadableFilesView = Backbone.Marionette.ItemView.extend({
  template: 'templates/uploadable_files',

  className: 'uploadable_files',

  ui: {
    header: 'h2'
  },

  initialize: function() {
    this.uploadableFiles = this.collection.uploadable();

    if (!this.options.selection.has('file')) {
      this.options.selection.set('file', this.uploadableFiles.first());
    }
  },

  onRender: function() {
    this.ui.header.text(
      I18n.t('pageflow.editor.files.tabs.' + this.options.fileType.collectionName)
    );

    this.appendSubview(new pageflow.TableView({
      collection: this.uploadableFiles,
      attributeTranslationKeyPrefixes: [
        'pageflow.editor.files.attributes.' + this.options.fileType.collectionName,
        'pageflow.editor.files.common_attributes'
      ],
      columns: this.commonColumns().concat(this.fileTypeColumns()),
      selection: this.options.selection,
      selectionAttribute: 'file'
    }));

    this.listenTo(this.uploadableFiles, 'add remove', this.update);
    this.update();
  },

  update: function() {
    this.$el.toggleClass('is_empty', this.uploadableFiles.length === 0);
  },

  commonColumns: function() {
    return [
      {name: 'file_name', cellView: pageflow.TextTableCellView},
      {name: 'rights', cellView: pageflow.PresenceTableCellView}
    ];
  },

  fileTypeColumns: function() {
    return _(this.options.fileType.confirmUploadTableColumns).map(function(column) {
      return _.extend({}, column, {
        configurationAttribute: true
      });
    });
  }
});

Version data entries

58 entries across 58 versions & 1 rubygems

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