Sha256: 6805e3441c6841247f815c377041f1394c626c25e66015607e49c8fe1c9a2165

Contents?: true

Size: 862 Bytes

Versions: 46

Compression:

Stored size: 862 Bytes

Contents

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

  mixins: [pageflow.selectableView],

  selectionAttribute: 'theme',

  ui: {
    themeName: '.theme_name',
    useButton: '.use_theme',
    inUseRegion: '.theme_in_use'
  },

  events: {
    'click .use_theme': function() {
      this.options.onUse(this.model);
    },
    'mouseenter': 'select',
    'click': 'select'
  },

  onRender: function() {
    this.$el.data('themeName', this.model.get('name'));
    this.ui.themeName.text(this.model.title());

    if (this.inUse()) {
      this.ui.inUseRegion.text('✓');
    }

    this.ui.useButton.toggle(
      !this.inUse()
    );
  },

  inUse: function() {
    return this.model.get('name') === this.options.themeInUse;
  }
});

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
pageflow-13.0.0.beta4 app/assets/javascripts/pageflow/editor/views/theme_item_view.js
pageflow-13.0.0.beta3 app/assets/javascripts/pageflow/editor/views/theme_item_view.js
pageflow-13.0.0.beta2 app/assets/javascripts/pageflow/editor/views/theme_item_view.js
pageflow-13.0.0.beta1 app/assets/javascripts/pageflow/editor/views/theme_item_view.js
pageflow-12.2.0 app/assets/javascripts/pageflow/editor/views/theme_item_view.js
pageflow-12.1.0 app/assets/javascripts/pageflow/editor/views/theme_item_view.js