Class: SimpleTimeInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Defined in:
app/inputs/simple_time_input.rb

Instance Method Summary collapse

Instance Method Details

#icon_clockObject



27
28
29
# File 'app/inputs/simple_time_input.rb', line 27

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

#input(_wrapper_options) ⇒ Object



4
5
6
7
8
9
# File 'app/inputs/simple_time_input.rb', line 4

def input(_wrapper_options)
  template.(:div, class: "row collapse datepicker-wrapper") do
    template.concat prefix_column
    template.concat input_column
  end
end

#input_columnObject



17
18
19
20
21
22
23
24
25
# File 'app/inputs/simple_time_input.rb', line 17

def input_column
  html_options = input_html_options
  html_options[:class] ||= []
  template.(: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

#input_typeObject



31
32
33
# File 'app/inputs/simple_time_input.rb', line 31

def input_type
  :string
end

#prefix_columnObject



11
12
13
14
15
# File 'app/inputs/simple_time_input.rb', line 11

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