Sha256: 83cd1a1d21c0a229b89852602cbb01f5e0c189733701ec4a99d72e19bd323065

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

pageflow.externalLinks.SitesView = Backbone.Marionette.ItemView.extend({
  className: 'manage_external_sites',
  template: 'pageflow/external_links/editor/templates/sites',

  events: {
    'click .add': function() {
      var site = pageflow.externalLinks.sites.create({title: ''});
      var options = this.options;

      site.once('sync', function() {
        var query = options.page ? '/?page=' + options.page.id + '&return_to=sites' : '';
        pageflow.editor.navigate('external_links/sites/' + site.id + query, {trigger: true});
      });
    }
  },

  onRender: function() {
    pageflow.externalLinks.sites.ensureFetched();

    this.$el.append(this.subview(new pageflow.CollectionView({
      tagName: 'ul',
      className: 'sites',
      collection: pageflow.externalLinks.sites,
      itemViewConstructor: pageflow.externalLinks.SiteItemView,
      itemViewOptions: {
        selectionHandler: this.options.selectionHandler,
        referer: this.options.referer,
        page: this.options.page
      },
      blankSlateViewConstructor: Backbone.Marionette.ItemView.extend({
        template: 'pageflow/external_links/editor/templates/sites_blank_slate'
      })
    })).el);
  }
});

Version data entries

3 entries across 3 versions & 1 rubygems

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