Sha256: 041f9782c6b92718ec7bbc516574b1fc6c4652ca840199bc0d88fd339ef01717

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

pageflow.EntryPublicationQuotaDecoratorView = Backbone.Marionette.Layout.extend({
  template: 'templates/entry_publication_quota_decorator',
  className: 'quota_decorator',

  regions: {
    outlet: '.outlet'
  },

  ui: {
    state: '.quota_state',
    exhaustedMessage: '.exhausted_message'
  },

  modelEvents: {
    'change:exceeding change:checking change:quota': 'update'
  },

  onRender: function() {
    this.model.check();
  },

  update: function() {
    var view = this;

    if (this.model.get('checking')) {
      view.ui.state.text(I18n.t('editor.quotas.loading'));
      view.ui.exhaustedMessage.hide().html('');
      view.outlet.close();
    }
    else {
      if (view.model.get('exceeding')) {
        view.ui.state.hide();
        view.ui.exhaustedMessage.show().html(view.model.get('exhausted_html'));
        view.outlet.close();
      }
      else {
        if (view.model.quota().get('state_description')) {
          view.ui.state.text(view.model.quota().get('state_description'));
          view.ui.state.show();
        }
        else {
          view.ui.state.hide();
        }

        view.outlet.show(view.options.view);
      }
    }
  }
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-0.6.0 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js
pageflow-0.5.0 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js
pageflow-0.4.0 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js
pageflow-0.3.0 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js
pageflow-0.2.1 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js
pageflow-0.2.0 app/assets/javascripts/pageflow/editor/views/entry_publication_quota_decorator_view.js