Sha256: 6ff733ff2db0da128b85bba702cc73eba86ac2f2a9a29e30b3f12e374dd17bbb

Contents?: true

Size: 1.17 KB

Versions: 35

Compression:

Stored size: 1.17 KB

Contents

class DatePickerInput < SimpleForm::Inputs::StringInput
  # Note that where we use `wrapper: :clockpicker` or `wrapper: horizontal_clockpicker`,
  # #input is not called and we call #prefix_column and #input_column directly.
  def input(_wrapper_options)
    template.content_tag(:div, class: "row collapse #{class_name}-wrapper") do
      template.concat prefix_column
      template.concat input_column
    end
  end

  def prefix_column(_wrapper_options = {})
    template.content_tag(:div, class: "small-2 columns") do
      template.concat icon_calendar
    end
  end

  def input_column(_wrapper_options = {})
    html_options = input_html_options
    html_options[:class] ||= []
    html_options[:class] << class_name
    template.content_tag(:div, class: "small-10 columns") do
      datestamp = @builder.object.public_send(attribute_name)
      value = datestamp.present? ? I18n.l(datestamp) : ""
      template.concat @builder.text_field(attribute_name, html_options.merge(value: value))
    end
  end

  def icon_calendar
    "<span class='prefix'><i class='fa fa-calendar'></i></span>".html_safe
  end

  def input_type
    :string
  end

  def class_name
    "datepicker"
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/inputs/date_picker_input.rb
renalware-core-2.0.15 app/inputs/date_picker_input.rb
renalware-core-2.0.14 app/inputs/date_picker_input.rb
renalware-core-2.0.13 app/inputs/date_picker_input.rb
renalware-core-2.0.12 app/inputs/date_picker_input.rb
renalware-core-2.0.11 app/inputs/date_picker_input.rb
renalware-core-2.0.9 app/inputs/date_picker_input.rb
renalware-core-2.0.8 app/inputs/date_picker_input.rb
renalware-core-2.0.7 app/inputs/date_picker_input.rb
renalware-core-2.0.5 app/inputs/date_picker_input.rb
renalware-core-2.0.4 app/inputs/date_picker_input.rb
renalware-core-2.0.3 app/inputs/date_picker_input.rb
renalware-core-2.0.2 app/inputs/date_picker_input.rb
renalware-core-2.0.1 app/inputs/date_picker_input.rb
renalware-core-2.0.0 app/inputs/date_picker_input.rb
renalware-core-2.0.0.pre.rc13 app/inputs/date_picker_input.rb
renalware-core-2.0.0.pre.rc11 app/inputs/date_picker_input.rb
renalware-core-2.0.0.pre.rc10 app/inputs/date_picker_input.rb
renalware-core-2.0.0.pre.rc9 app/inputs/date_picker_input.rb
renalware-core-2.0.0.pre.rc8 app/inputs/date_picker_input.rb