Class: TimezoneClockIconInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/timezone_clock_icon_input.rb

Overview

Output HTML for a timezone select form field.

The HTML generated is compatible with Bootstrap, and it prepends a time icon (from FontAwesome) before the input.

This class is intended to be used from simple_form forms like this:

<%= simple_form_for user, wrapper: :prepend do %>
  <%= f.input :timezone, as: :timezone_clock_icon %>
  ...
<% end %>

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object


15
16
17
# File 'app/inputs/timezone_clock_icon_input.rb', line 15

def input(wrapper_options)
  "<span class=\"input-group-addon\"><i class=\"fa fa-fw fa-clock-o\"></i></span>#{@builder.input_field(attribute_name, as: :time_zone, priority: /UTC/)}".html_safe
end