Module: Bootsy::FormHelper

Defined in:
lib/bootsy/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#bootsy_area(object, method, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bootsy/form_helper.rb', line 3

def bootsy_area(object, method, options = {})
  container = options.delete(:container)
  bootsy_options = Bootsy.editor_options.merge(options.delete(:editor_options) || {})

  bootsy_options[:uploader] = enable_uploader?(object, options.delete(:uploader), container)

  options[:data] = data_options(options, bootsy_options)
  options[:class] = class_attr(options)

  output = self.text_area(object_name(object), method, options)

  if bootsy_options[:uploader]
    output += self.render 'bootsy/images/modal', { container: container || object }

    if container.blank? || (container == object)
      output += self.hidden_field(object_name(object), :bootsy_image_gallery_id, class: 'bootsy_image_gallery_id')
    end
  end

  output
end