Sha256: b0b8cc7c29951c27266750108513ce3117a1e55b8913704acef0fa1c1f3bc7c6
Contents?: true
Size: 1.93 KB
Versions: 7
Compression:
Stored size: 1.93 KB
Contents
pageflow.Page = Backbone.Model.extend({ modelName: 'page', paramRoot: 'page', i18nKey: 'pageflow/page', defaults: function() { return { template: 'background_image', configuration: {}, active: false, perma_id: '' }; }, mixins: [pageflow.failureTracking, pageflow.delayedDestroying], initialize: function() { this.configuration = new pageflow.Configuration(this.get('configuration') || {}); this.configuration.parent = this.configuration.page = this; this.listenTo(this.configuration, 'change', function() { this.trigger('change:configuration'); }); this.listenTo(this.configuration, 'change:title', function() { this.trigger('change:title'); }); this.listenTo(this.configuration, 'change', function() { this.save(); }); this.listenTo(this, 'change:template', function() { this.save(); }); }, urlRoot: function() { return this.isNew() ? this.collection.url() : '/pages'; }, chapterPosition: function() { return (this.chapter && this.chapter.get('position')) || -1; }, title: function() { return this.configuration.get('title') || this.configuration.get('additional_title'); }, thumbnailFile: function() { var configuration = this.configuration; return _.reduce(this.pageType().thumbnail_candidates, function(result, candidate) { return result || configuration.getReference(candidate.attribute, candidate.file_collection); }, null); }, pageType: function() { return pageflow.Page.typesByName[this.get('template')]; }, toJSON: function() { return _.extend(_.clone(this.attributes), { configuration: this.configuration.toJSON() }); }, destroy: function() { this.destroyWithDelay(); } }); pageflow.Page.transitions = ['fade', 'scroll']; pageflow.Page.linkedPagesLayouts = ['default', 'hero_top_left', 'hero_top_right']; pageflow.Page.textPositions = ['left', 'right'];
Version data entries
7 entries across 7 versions & 1 rubygems