Sha256: 72db05630e0a48c7df31238e2d267129934fa6a134bea2ace07bf197c005aea7

Contents?: true

Size: 673 Bytes

Versions: 22

Compression:

Stored size: 673 Bytes

Contents

pageflow.linkmapPage.PageLinkAreaType = Backbone.Model.extend({
  defaults: function() {
    return {
      label: I18n.t('pageflow.linkmap_page.editor.area_types.page')
    };
  },

  initialize: function(attributes, options) {
    this.areas = options.pageConfiguration.linkmapAreas();

    this.listenTo(this.areas, 'add remove', function() {
      this.updateDisabled();
    });

    this.updateDisabled();
  },

  updateDisabled: function() {
    this.set('disabled', !this.areas.canAddLink());
  },

  selected: function() {
    var areas = this.areas;

    pageflow.editor.selectPage().then(function(page) {
      areas.addLink(page.get('perma_id'));
    });
  }
});

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pageflow-linkmap-page-0.2.0 app/assets/javascript/pageflow/linkmap_page/editor/models/page_link_area_type.js
pageflow-linkmap-page-0.1.0 app/assets/javascript/pageflow/linkmap_page/editor/models/page_link_area_type.js