Class: ActiveAdmin::Inputs::Filters::DateRangeInput
- Inherits:
-
Formtastic::Inputs::StringInput
- Object
- Formtastic::Inputs::StringInput
- ActiveAdmin::Inputs::Filters::DateRangeInput
show all
- Includes:
- Base
- Defined in:
- lib/active_admin/inputs/filters/date_range_input.rb
Instance Method Summary
collapse
Methods included from Base
#collection_from_options, #input_wrapping, #label_from_options, #required?, #wrapper_html_options
#column, #column_for, #has_predicate?, #humanized_method_name, #klass, #polymorphic_foreign_type?, #ransacker?, #reflection_for, #scope?, #searchable_has_many_through?, #seems_searchable?
#input_wrapping
Instance Method Details
17
18
19
|
# File 'lib/active_admin/inputs/filters/date_range_input.rb', line 17
def gt_input_name
"#{method}_gteq_date"
end
|
26
27
28
29
30
31
32
|
# File 'lib/active_admin/inputs/filters/date_range_input.rb', line 26
def input_html_options(input_name = gt_input_name)
current_value = @object.public_send input_name
{ size: 12,
class: "datepicker",
maxlength: 10,
value: current_value.respond_to?(:strftime) ? current_value.strftime("%Y-%m-%d") : "" }
end
|
22
23
24
|
# File 'lib/active_admin/inputs/filters/date_range_input.rb', line 22
def lt_input_name
"#{method}_lteq_date"
end
|
#to_html ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/active_admin/inputs/filters/date_range_input.rb', line 7
def to_html
input_wrapping do
[ label_html,
builder.text_field(gt_input_name, input_html_options(gt_input_name)),
template.content_tag(:span, "-", class: "seperator"),
builder.text_field(lt_input_name, input_html_options(lt_input_name)),
].join("\n").html_safe
end
end
|