Class: SimpleFormExtension::Inputs::ColorInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- SimpleFormExtension::Inputs::ColorInput
- Defined in:
- lib/simple_form_extension/inputs/color_input.rb
Instance Method Summary collapse
Instance Method Details
#align ⇒ Object
32 33 34 |
# File 'lib/simple_form_extension/inputs/color_input.rb', line 32 def align [:align].presence || :right end |
#format ⇒ Object
28 29 30 |
# File 'lib/simple_form_extension/inputs/color_input.rb', line 28 def format [:format].presence || :hex end |
#input(wrapper_options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simple_form_extension/inputs/color_input.rb', line 6 def input( = nil) [:class] << "colorpicker form-control" [:data] ||= {} [:data].merge!( colorpicker: true, format: format, align: align ) # Fetch value color = object.send(attribute_name) content_tag(:div, class: 'input-group color', data: { :'colorpicker-wrapper' => true }) do @builder.text_field(attribute_name, ) + content_tag(:span, class: 'input-group-addon') do content_tag(:i, '') end end end |