Sha256: d196fe025488811cdea511a90ff47d0967f11afe5daad3a29ba933af83c4cf0f

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

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

  regions: {
    outlet: '.outlet'
  },

  ui: {
    state: '.quota_state',
    exceededMessage: '.exceeded_message'
  },

  onRender: function() {
    var view = this;

    view.ui.state.text(I18n.t('editor.quotas.loading'));
    view.ui.exceededMessage.html('');
    view.outlet.close();

    view.model.fetch({
      success: function() {
        if (view.model.isExceeded()) {
          view.ui.state.hide();
          view.ui.exceededMessage.html(view.model.get('exceeded_html'));
        }
        else {
          if (view.model.get('state_description')) {
            view.ui.state.text(view.model.get('state_description'));
            view.ui.state.show();
          }
          else {
            view.ui.state.hide();
          }

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

      error: function() {
        view.ui.state.text(I18n.t('editor.quota.error'));
      }
    });
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pageflow-0.1.0 app/assets/javascripts/pageflow/editor/views/quota_decorator_view.js