Sha256: b99c679631a50bc358d94d9cc4d2fa1ad516840c0ad59b2c6bfd85bfb34eac6f

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

pageflow.externalLinks.SiteItemView = Backbone.Marionette.ItemView.extend({
  tagName: 'li',
  template: 'pageflow/external_links/editor/templates/site_item',

  mixins: [pageflow.loadable],

  ui: {
    title: '.title',
    selectButton: '.select',
    thumbnail: '.thumbnail'
  },

  events: {
    'click': function() {
      if (!this.model.isNew()) {
        var query = this.options.page ? '/?page=' + this.options.page.id + '&return_to=sites' : '';
        pageflow.editor.navigate('/external_links/sites/' + this.model.get('id') + query, {trigger: true});
      }
      return false;
    },

    'click .select': function() {
      if (this.options.selectionHandler) {
        this.options.selectionHandler.call(this.model);
        pageflow.editor.navigate(this.options.referer, {trigger: true});
      }
      return false;
    }
  },

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

    this.subview(new pageflow.FileThumbnailView({
      el: this.ui.thumbnail,
      model: this.model.getReference('thumbnail', pageflow.imageFiles)
    }));
  },

  update: function() {
    this.ui.title.text(this.model.get('title') || '(Unbenannt)');
    this.ui.selectButton.toggle(!!this.options.selectionHandler);
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-external-links-0.1.0 app/assets/javascript/pageflow/external_links/editor/views/site_item_view.js
pageflow-external-links-0.0.1 app/assets/javascript/pageflow/external_links/editor/views/site_item_view.js