Sha256: f3fe3a83a0addbf5b451d0246e6f6e26bac81160d0d7e6cc3eefe9e0fed4695d

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

module FilterInputs
  class DateRangeInput < SimpleForm::Inputs::StringInput
    def input(wrapper_options = nil)
      @wrapper_options = wrapper_options
      out = []

      out << input_html
      out.join.html_safe
    end

    def input_html
      merged_input_options = merge_wrapper_options(input_html_options, @wrapper_options)
      [
        @builder.text_field(gt_input_name, merged_input_options.merge(placeholder: gt_input_placeholder, class: 'date-picker form-control')),
        @builder.text_field(lt_input_name, merged_input_options.merge(placeholder: lt_input_placeholder, class: 'date-picker form-control'))
      ].join("\n").html_safe
    end

    def gt_input_name
      "#{attribute_name}_gteq"
    end
    alias :input_name :gt_input_name

    def lt_input_name
      "#{attribute_name}_lteq"
    end

    def gt_input_placeholder
      'От'
    end

    def lt_input_placeholder
      'До'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminos-1.0.0.pre.rc.5 app/inputs/filter_inputs/date_range_input.rb
adminos-1.0.0.pre.rc.4 app/inputs/filter_inputs/date_range_input.rb
adminos-1.0.0.pre.rc.3 app/inputs/filter_inputs/date_range_input.rb