engine/app/assets/javascripts/locomotive/models/page.js.coffee
Marko Iskander 02ea6913e3 Merge branch 'master' into wildcards
Conflicts:
	Gemfile.lock
	app/assets/javascripts/locomotive/models/page.js.coffee
	app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee
	app/models/locomotive/extensions/site/locales.rb
	app/models/locomotive/page.rb
	app/views/locomotive/pages/_form.html.haml
	config/initializers/haml.rb
	config/locales/default.ru.yml
	config/locales/formtastic.ru.yml
	doc/TODO
	lib/locomotive/haml.rb
	script/upgrade_v1.rb
	spec/dummy/config/initializers/haml.rb
2012-05-22 20:39:30 -04:00

25 lines
780 B
CoffeeScript

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', '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
class Locomotive.Models.PagesCollection extends Backbone.Collection