Sha256: cdeb2cfab6b232f03e1e950985979667bc2d4d0970aff10638c96e69ea9c2019

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

module Formtastic
  module Inputs

    # Outputs a simple `<label>` with a HTML5 `<input type="color">` wrapped in the standard
    # `<li>` wrapper. This is the default input choice for attributes with a name matching
    # `/color/`, but can be applied to any text-like input with `:as => :color`.
    #
    # @example Full form context and output
    #
    #   <%= semantic_form_for(@user) do |f| %>
    #     <%= f.inputs do %>
    #       <%= f.input :color, :as => :color %>
    #     <% end %>
    #   <% end %>
    #
    #   <form...>
    #     <fieldset>
    #       <ol>
    #         <li class="color">
    #           <label for="user_color">Color</label>
    #           <input type="color" id="user_color" name="user[color]">
    #         </li>
    #       </ol>
    #     </fieldset>
    #   </form>
    #
    # @see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documentation of all possible options.
    class ColorInput 
      include Base
      include Base::Stringish
      include Base::Placeholder
      
      def to_html
        input_wrapping do
          label_html <<
          builder.color_field(method, input_html_options)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/color_input.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/color_input.rb
formtastic-4.0.0 lib/formtastic/inputs/color_input.rb
formtastic-4.0.0.rc1 lib/formtastic/inputs/color_input.rb