Module: Bootsy::FormHelper

Defined in:
lib/bootsy/form_helper.rb

Instance Method Summary collapse

Instance Method Details

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



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

def bootsy_area(object_name, method, options = {})
  container = options[:container] || options[:object]

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

  if output.present? && enable_uploader?(options)
    container.bootsy_image_gallery_id ||= Bootsy::ImageGallery.create!.id

    output += self.render('bootsy/images/modal', container: container)

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

  output
end