Sha256: 2beb60dea0df9f697b034f7112d4ee3a1d44116fab107d2684cf31aca017d031

Contents?: true

Size: 984 Bytes

Versions: 14

Compression:

Stored size: 984 Bytes

Contents

class Locomotive.Models.Page extends Backbone.Model

  paramRoot: 'page'

  urlRoot: "#{Locomotive.mounted_on}/pages"

  initialize: ->
    @_normalize()

    @set
      edit_url: "#{Locomotive.mounted_on}/pages/#{@id}/edit"

  _normalize: ->
    @set
      editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements') || [])

  toJSON: ->
    _.tap super, (hash) =>
      _.each ['fullpath', 'localized_fullpaths', 'templatized_from_parent', 'target_klass_name_text', 'content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]

      delete hash['editable_elements']
      hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0

      delete hash['target_klass_name']
      hash.target_klass_name = @get('target_klass_name') if @get('templatized') == true

class Locomotive.Models.PagesCollection extends Backbone.Collection

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
locomotive_cms-2.0.3 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.2 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.1 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0 app/assets/javascripts/locomotive/models/page.js.coffee
tribeca_cms-0.1.1 app/assets/javascripts/locomotive/models/page.js.coffee
tribeca_cms-2.0.0.rc12 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc12 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc11 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc10 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc9 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc8 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc7 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc6 app/assets/javascripts/locomotive/models/page.js.coffee
locomotive_cms-2.0.0.rc5 app/assets/javascripts/locomotive/models/page.js.coffee