Sha256: 15c27ee122580dfa6b5d3a503c5388a7d62fb71584af76e69662528849c6a89a

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

module Formtastic
  module Inputs

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
formtastic-2.0.2 lib/formtastic/inputs/url_input.rb
formtastic-2.0.1 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0.rc5 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0.rc4 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0.rc3 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0.rc2 lib/formtastic/inputs/url_input.rb
formtastic-2.0.0.rc1 lib/formtastic/inputs/url_input.rb
nuatt-formtastic-0.2.3 lib/formtastic/inputs/url_input.rb