2011-11-21 01:27:05 +00:00
|
|
|
class Locomotive.Models.Page extends Backbone.Model
|
|
|
|
|
2011-11-25 01:04:42 +00:00
|
|
|
paramRoot: 'page'
|
|
|
|
|
2012-01-14 13:54:01 +00:00
|
|
|
urlRoot: "#{Locomotive.mounted_on}/pages"
|
2011-11-25 01:04:42 +00:00
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
initialize: ->
|
2011-11-25 01:04:42 +00:00
|
|
|
@_normalize()
|
|
|
|
|
|
|
|
_normalize: ->
|
2011-11-21 01:27:05 +00:00
|
|
|
@set
|
|
|
|
editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
|
|
|
|
|
2011-11-25 01:04:42 +00:00
|
|
|
toJSON: ->
|
|
|
|
_.tap super, (hash) =>
|
|
|
|
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')
|
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
class Locomotive.Models.PagesCollection extends Backbone.Collection
|