engine/app/assets/javascripts/locomotive/models/page.js.coffee
2011-11-25 13:38:31 +01:00

18 lines
491 B
CoffeeScript

class Locomotive.Models.Page extends Backbone.Model
paramRoot: 'page'
urlRoot: "#{Locomotive.mount_on}/pages"
initialize: ->
@_normalize()
_normalize: ->
@set
editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
toJSON: ->
_.tap super, (hash) =>
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')
class Locomotive.Models.PagesCollection extends Backbone.Collection