Module: FrontendEditorHelper

Defined in:
app/helpers/frontend_editor_helper.rb

Instance Method Summary collapse

Instance Method Details

#editable(model, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/frontend_editor_helper.rb', line 2

def editable(model, options = {})
  options[:id] ||= model.id
  options[:method] ||= 'body'
  options[:object] ||= model.class.name.demodulize.pluralize.downcase
  options[:prefix] ||= ''

  (:div,
    class: 'editable-long-text',
    data: {
      object: options[:object],
      id: options[:id],
      attribute: options[:method],
      prefix: options[:prefix]
    } ) do

    raw(yield)
  end
end