Sha256: 7242a74a0fb7bab3bfda4436105aac10984717bc6b53891e3f3d310170b4d887

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

pageflow.externalLinks.SiteSelectionView = Backbone.Marionette.ItemView.extend({
  className: 'external_site_selection dialog',
  template: 'pageflow/external_links/editor/templates/site_selection',

  mixins: [pageflow.dialogView],

  ui: {
    items: 'ul'
  },

  onRender: function() {
    var view = this;

    pageflow.externalLinks.sites.ensureFetched();

    this.subview(new pageflow.CollectionView({
      el: this.ui.items,
      collection: pageflow.externalLinks.sites,
      itemViewConstructor: pageflow.externalLinks.SiteItemView,
      itemViewOptions: {
        selectionHandler: function() {
          view.options.onSelect(this);
          view.close();
        }
      },
      blankSlateViewConstructor: Backbone.Marionette.ItemView.extend({
        template: 'pageflow/external_links/editor/templates/sites_blank_slate'
      })
    }));
  }
});

pageflow.externalLinks.SiteSelectionView.selectSite = function() {
  return $.Deferred(function(deferred) {
    var view = new pageflow.externalLinks.SiteSelectionView({
      onSelect: deferred.resolve
    });

    view.on('close', function() {
      deferred.reject();
    });

    pageflow.app.dialogRegion.show(view.render());
  }).promise();
};

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pageflow-external-links-2.3.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-2.2.1 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-2.2.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-2.1.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-1.1.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-2.0.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-2.0.0.beta1 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-1.0.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-0.4.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js
pageflow-external-links-0.3.0 app/assets/javascripts/pageflow/external_links/editor/views/site_selection_view.js