Module: Optimacms::FormsHelper

Defined in:
app/helpers/optimacms/forms_helper.rb

Instance Method Summary collapse

Instance Method Details

#horizontal_simple_form_for(resource, options = {}, &block) ⇒ Object



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

def horizontal_simple_form_for(resource, options = {}, &block)
  options[:html] ||= {}

  # class
  options[:html][:class] ||= []
  if options[:html][:class].is_a? Array
    options[:html][:class] << 'form-horizontal'
  else
    options[:html][:class] << ' form-horizontal'
  end
  options[:html][:role] = 'form'


  options[:wrapper] = :horizontal_form
  options[:wrapper_mappings] = {check_boxes: :horizontal_radio_and_checkboxes, radio_buttons: :horizontal_radio_and_checkboxes, file: :horizontal_file_input,boolean: :horizontal_boolean      }
  simple_form_for(resource, options, &block)
end

#horizontal_simple_search_form_for(filter_object, options = {}, &block) ⇒ Object



56
57
58
# File 'app/helpers/optimacms/forms_helper.rb', line 56

def horizontal_simple_search_form_for(filter_object, options = {}, &block)
  return render 'tableview/filter.html.haml', style: :horizontal, filter_object: filter_object
end

#inline_simple_search_form_for(filter_object, options = {}, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/helpers/optimacms/forms_helper.rb', line 23

def inline_simple_search_form_for(filter_object, options = {}, &block)
  return render 'tableview/filter.html.haml', style: :inline, filter_object: filter_object
  return

  options[:html] ||= {}

  options[:url] = send(filter_object.url)

  options[:html][:role] = 'form'

  # class
  options[:html][:class] ||= []
  if options[:html][:class].is_a? String
    options[:html][:class] = [options[:html][:class]]
  end
  options[:html][:class] << 'form-inline'
  options[:html][:id] = 'formFilter'

  options[:wrapper] = :inline_search_form
  options[:wrapper_mappings] = {      }


  capture do
    simple_form_for(:filter, options) do |f|
      concat(hidden_field_tag 'cmd', 'apply')
      concat(render 'tableview/filter_fields', filter: filter_object, f: f)
      concat(render 'tableview/buttons_apply_clear_inline', filter: filter_object, f: f)
    end
  end

end