feat: add page_settings JSON property + ACE JSON mode
- Add property :page_settings (Hash, default {}) to Page model
- JSON.parse string input in setter (form submits as text)
- Add collapsible 'Page Settings (JSON)' section to page form
- Support data-mode='json' attribute for ACE editor
(html_edit.js.coffee: check textarea data-mode attribute)
This commit is contained in:
@@ -21,6 +21,13 @@ module Cmtool
|
||||
klass.property :active, type: :boolean, default: true
|
||||
klass.property :layout
|
||||
klass.property :in_menu, type: :boolean, default: true
|
||||
klass.property :page_settings, default: {}
|
||||
|
||||
# Parse JSON string from form submission
|
||||
klass.send(:define_method, :page_settings=) do |val|
|
||||
val = JSON.parse(val) if val.is_a?(String)
|
||||
super(val)
|
||||
end
|
||||
|
||||
klass.has_ancestry by_property: :locale
|
||||
|
||||
|
||||
Reference in New Issue
Block a user