Sha256: 6eab73b2507b8e8af53b6611e382e59516e938072dbbc317ca9db484897b892e

Contents?: true

Size: 890 Bytes

Versions: 35

Compression:

Stored size: 890 Bytes

Contents

class SimpleTimeInput < SimpleForm::Inputs::StringInput
  def input(_wrapper_options)
    template.content_tag(:div, class: "row collapse datepicker-wrapper") do
      template.concat prefix_column
      template.concat input_column
    end
  end

  def prefix_column
    template.content_tag(:div, class: "large-2 columns") do
      template.concat icon_clock
    end
  end

  def input_column
    html_options = input_html_options
    html_options[:class] ||= []
    template.content_tag(:div, class: "large-10 columns") do
      time = @builder.object.public_send(attribute_name)
      value = time.present? ? I18n.l(time, format: :time) : ""
      template.concat @builder.text_field(attribute_name, html_options.merge(value: value))
    end
  end

  def icon_clock
    "<span class='prefix'><i class='fa fa-clock-o'></i></span>".html_safe
  end

  def input_type
    :string
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

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