Sha256: de757e78d2dd59fa181edca5abb4d91410c590d270fe5a6b5a769b5c9d6ffab4

Contents?: true

Size: 1.03 KB

Versions: 58

Compression:

Stored size: 1.03 KB

Contents

/** @api private */
pageflow.DropDownButtonItemView = Backbone.Marionette.ItemView.extend({
  template: 'pageflow/editor/templates/drop_down_button_item',
  tagName: 'li',
  className: 'drop_down_button_item',

  ui: {
    link: '> a',
    label: '> .label'
  },

  events: {
    'click > a': function() {
      if (!this.model.get('disabled')) {
        this.model.selected();
      }

      return false;
    }
  },

  modelEvents: {
    change: 'update'
  },

  onRender: function() {
    this.update();

    if (this.model.get('items')) {
      this.appendSubview(new pageflow.DropDownButtonItemListView({
        items: this.model.get('items')
      }));
    }
  },

  update: function() {
    this.ui.link.text(this.model.get('label'));
    this.ui.label.text(this.model.get('label'));

    this.$el.toggleClass('is_selectable', !!this.model.selected);
    this.$el.toggleClass('is_disabled', !!this.model.get('disabled'));
    this.$el.toggleClass('is_checked', !!this.model.get('checked'));

    this.$el.data('name', this.model.get('name'));
  }
});

Version data entries

58 entries across 58 versions & 1 rubygems

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