Module: Optimacms::FormsHelper
- Defined in:
- app/helpers/optimacms/forms_helper.rb
Instance Method Summary collapse
- #horizontal_simple_form_for(resource, options = {}, &block) ⇒ Object
- #horizontal_simple_search_form_for(filter_object, options = {}, &block) ⇒ Object
- #inline_simple_search_form_for(filter_object, options = {}, &block) ⇒ Object
- #link_to_sortable_column(field_name, title = nil, html_options = nil, &block) ⇒ Object
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, = {}, &block) [:html] ||= {} # class [:html][:class] ||= [] if [:html][:class].is_a? Array [:html][:class] << 'form-horizontal' else [:html][:class] << ' form-horizontal' end [:html][:role] = 'form' [:wrapper] = :horizontal_form [: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, , &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, = {}, &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, = {}, &block) return render 'tableview/filter.html.haml', style: :inline, filter_object: filter_object return [:html] ||= {} [:url] = send(filter_object.url) [:html][:role] = 'form' # class [:html][:class] ||= [] if [:html][:class].is_a? String [:html][:class] = [[:html][:class]] end [:html][:class] << 'form-inline' [:html][:id] = 'formFilter' [:wrapper] = :inline_search_form [:wrapper_mappings] = { } capture do simple_form_for(:filter, ) 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 |
#link_to_sortable_column(field_name, title = nil, html_options = nil, &block) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/helpers/optimacms/forms_helper.rb', line 61 def link_to_sortable_column(field_name, title = nil, = nil, &block) ||= {} if @filter.search_method_post_and_redirect? [:method] = :post end url = send(@filter.url, @filter.url_params_for_sortable_column(field_name)) link_to(title, url, ) end |