Sha256: 229f8cf0e6e3610c5ffd9730d7ff282f735cf9d7a1a627bf4a841770adadcc35

Contents?: true

Size: 1.41 KB

Versions: 33

Compression:

Stored size: 1.41 KB

Contents

pageflow.FileStageItemView = Backbone.Marionette.ItemView.extend({
  tagName: 'li',
  className: 'file_stage_item',
  template: 'templates/file_stage_item',

  ui: {
    description: '.description',
    percent: '.percent',
    errorMessage: '.error_message'
  },

  modelEvents: {
    'change': 'update'
  },

  onRender: function() {
    this.update();
    this.$el.addClass(this.model.get('name'));

    if (this.options.standAlone) {
      this.$el.addClass('stand_alone');
    }
    else {
      this.$el.addClass('indented');
    }
  },

  update: function() {
    this.ui.description.text(this.model.localizedDescription());

    if (typeof this.model.get('progress') === 'number' &&
        this.model.get('active')) {
      this.ui.percent.text(this.model.get('progress') + '%');
    }
    else {
      this.ui.percent.text('');
    }

    this.ui.errorMessage
      .toggle(!!this.model.get('error_message'))
      .text(this._translatedErrorMessage());

    this.$el.toggleClass('active', this.model.get('active'));
    this.$el.toggleClass('finished', this.model.get('finished'));
    this.$el.toggleClass('failed', this.model.get('failed'));
    this.$el.toggleClass('action_required', this.model.get('action_required'));
  },

  _translatedErrorMessage: function() {
    return this.model.get('error_message') &&
      I18n.t(this.model.get('error_message'), {
        defaultValue: this.model.get('error_message')
      });
  }
});

Version data entries

33 entries across 33 versions & 1 rubygems

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