Sha256: 78a58e3e5a7c51f1d98f0437863e01d7f89f6ddba8fe11ab3c4b87a93a1d8735

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 Bytes

Contents

pageflow.internalLinks.PageLink = Backbone.Model.extend({
  i18nKey: 'pageflow/internal_links/page_link',

  targetPage: function() {
    return pageflow.pages.getByPermaId(this.get('target_page_id'));
  },

  label: function() {
    return this.get('label');
  },

  editPath: function() {
    return '/internal_links_pages/' + this.getRoutableId() + '/page_links/' + this.id;
  },

  getRoutableId: function() {
    return this.collection.page.id;
  },

  toSerializedJSON: function() {
    return _.omit(this.attributes, 'highlighted');
  },

  highlight: function() {
    this.set('highlighted', true);
  },

  resetHighlight: function() {
    this.unset('highlighted');
  },

  remove: function() {
    this.collection.remove(this);
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-internal-links-0.2.0 app/assets/javascripts/pageflow/internal_links/editor/models/page_link.js
pageflow-internal-links-0.1.0 app/assets/javascripts/pageflow/internal_links/editor/models/page_link.js