module AtomicCms::Editor
Public Class Methods
included(base)
click to toggle source
# File lib/atomic_cms/editor.rb, line 3 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
children()
click to toggle source
# File lib/atomic_cms/editor.rb, line 27 def children options[:children] ||= [] end
edit()
click to toggle source
# File lib/atomic_cms/editor.rb, line 7 def edit render end
edit_array(inline = false)
click to toggle source
# File lib/atomic_cms/editor.rb, line 11 def edit_array(inline = false) cms_array_node(inline) do edit end end
render_child_array()
click to toggle source
# File lib/atomic_cms/editor.rb, line 17 def render_child_array cms_array(:children) do rtn = "" children.each do |child| rtn << cms_array_node { child.edit } end rtn.html_safe end end
Protected Instance Methods
cms_array(name, inline = false, &block)
click to toggle source
# File lib/atomic_cms/editor.rb, line 61 def cms_array(name, inline = false, &block) tag = inline ? :span : :div h.content_tag(tag, class: 'cms-array', data: { cms_node: name }, &block) end
cms_array_node(inline = false, &block)
click to toggle source
# File lib/atomic_cms/editor.rb, line 66 def cms_array_node(inline = false, &block) tag = inline ? :span : :div h.content_tag(tag, class: 'cms-array-node', data: { cms_node: '', ng_click: 'edit(); $event.stopPropagation();' }, &block) end
cms_fields(fields = {})
click to toggle source
# File lib/atomic_cms/editor.rb, line 71 def cms_fields(fields = {}) rtn = h.render partial: 'components/template_field', locals: { value: component_name } rtn << h.content_tag(:span, class: 'cms-fields') do fields.map do |field, options| h.render partial: "components/#{options[:field_type]}_field", locals: { name: field, value: local_options[field], options: options } end.join('').html_safe end end
cms_node(name, inline = false, &block)
click to toggle source
# File lib/atomic_cms/editor.rb, line 56 def cms_node(name, inline = false, &block) tag = inline ? :span : :div h.content_tag(tag, data: { cms_node: name, ng_click: 'edit(); $event.stopPropagation();' }, &block) end
markdown_preview(name)
click to toggle source
# File lib/atomic_cms/editor.rb, line 80 def markdown_preview(name) h.content_tag :div, '', data: {ng_bind_html: "#{name} | markdown"} end