Method: CustomTable::ApplicationHelper#custom_table_form_for

Defined in:
app/helpers/custom_table/application_helper.rb

#custom_table_form_for(record, options = {}, &block) ⇒ Object

MOVE TO GENERATED HELPER def boolean_icon(value, true_value = nil, false_value = nil)

capture do
  concat (:i, "", class: (value ? "bi bi-check-lg text-success" : "bi bi-x-lg text-danger"), data: {raw: value})
  concat (:span, value ? true_value : false_value, class: "ms-1") unless true_value.nil?
end

end



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/custom_table/application_helper.rb', line 12

def custom_table_form_for(record, options = {}, &block)
  options[:url] = request.path if options[:url].nil?
  options[:method] = :get
  
  options[:html] ||= {} 
  options[:html][:class] = "row row-cols-sm-auto g-3 align-items-center custom-table-filter"
  options[:wrapper] = options[:wrapper] || :ct_inline_form
  
  options[:wrapper_mappings] = {
    boolean: :ct_inline_boolean,
    check_boxes: :ct_vertical_collection,
    radio_buttons: :ct_vertical_collection,
    date: :ct_inline_element,
    select: :ct_inline_select
  }

  simple_form_for(record, options, &block)
end