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()
|
|
|
|
|
2012-01-17 11:05:39 +00:00
|
|
|
@set
|
|
|
|
edit_url: "#{Locomotive.mounted_on}/pages/#{@id}/edit"
|
|
|
|
|
2011-11-25 01:04:42 +00:00
|
|
|
_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
|