Sha256: 7bea34645371cec38c4c56aba1ffa7df9d7e4a690855a0b08a1becff0b0e5a53
Contents?: true
Size: 1016 Bytes
Versions: 1
Compression:
Stored size: 1016 Bytes
Contents
module ActiveAdmin module Inputs module Filters class DateRangeInput < ::Formtastic::Inputs::StringInput include Base 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 def gt_input_name "#{method}_gteq" end alias :input_name :gt_input_name def lt_input_name "#{method}_lteq" end def input_html_options(input_name = gt_input_name) current_value = @object.public_send input_name { size: 12, class: "datepicker", max: 10, value: current_value.respond_to?(:strftime) ? current_value.strftime("%m/%d/%Y") : "" } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yousty-activeadmin-1.0.17.pre | lib/active_admin/inputs/filters/date_range_input.rb |