Class: RangeSelectInput
- Inherits:
-
Formtastic::Inputs::StringInput
- Object
- Formtastic::Inputs::StringInput
- RangeSelectInput
- Includes:
- ActiveAdmin::Inputs::Filters::Base
- Defined in:
- app/inputs/range_select_input.rb
Instance Method Summary collapse
- #gt_input_name ⇒ Object (also: #input_name)
- #input_html_options(input_name = gt_input_name) ⇒ Object
- #lt_input_name ⇒ Object
- #to_html ⇒ Object
Instance Method Details
#gt_input_name ⇒ Object Also known as: input_name
15 16 17 |
# File 'app/inputs/range_select_input.rb', line 15 def gt_input_name "#{method}_gteq" end |
#input_html_options(input_name = gt_input_name) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/inputs/range_select_input.rb', line 25 def (input_name = gt_input_name) is_gt = (input_name == gt_input_name) { type: "number", step: "any", value: @object.public_send(input_name), placeholder: is_gt ? "min" : "max" } end |
#lt_input_name ⇒ Object
21 22 23 |
# File 'app/inputs/range_select_input.rb', line 21 def lt_input_name "#{method}_lteq" end |
#to_html ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/inputs/range_select_input.rb', line 4 def to_html input_wrapping do [ label_html, builder.text_field(gt_input_name, (gt_input_name)), template.content_tag(:span, "-", class: "separator"), builder.text_field(lt_input_name, (lt_input_name)), ].join("\n").html_safe end end |