Module: BillyCms::ContentHelper

Defined in:
app/helpers/billy_cms/content_helper.rb

Instance Method Summary collapse

Instance Method Details

#cms_image(obj, options = {}) ⇒ Object



16
17
18
19
20
21
# File 'app/helpers/billy_cms/content_helper.rb', line 16

def cms_image(obj, options = {})
     :div, class: "page-content page-content-binary", 'billycms-attribute'  => 'content', 'billycms-page' => obj[:id] do
      image_tag(obj.content.to_s) +
      file_field_tag(:obj_input_file)
    end
end

#page_field(page, field, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/billy_cms/content_helper.rb', line 4

def page_field(page, field, options = {})
  tag_name = options[:tag] || :div
  html_options = {
      :'billycms-attribute' => field.to_s,
      :'billycms-page' => page[:id],
      :contenteditable => false,
      :class => ''
  }.merge(options[:html] || {})
  html_options[:class] += " page-#{field.to_s}"
   tag_name, page.send(field).to_s.html_safe, html_options
end