Sha256: ee8e60b5c49336ce6d6a387bf7320befa73e4990a2b8c8f64f32042371229efc

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

module Formtastic
  module Inputs

    # Outputs a simple `<label>` with a `<textarea>` wrapped in the standard
    # `<li>` wrapper. This is the default input choice for database columns of the `:text` type,
    # but can forced on any text-like input with `:as => :text`.
    #
    # @example Full form context and output
    #
    #   <%= semantic_form_for(@user) do |f| %>
    #     <%= f.inputs do %>
    #       <%= f.input :first_name, :as => :string %>
    #     <% end %>
    #   <% end %>
    #
    #   <form...>
    #     <fieldset>
    #       <ol>
    #         <li class="string">
    #           <label for="user_first_name">First name</label>
    #           <input type="text" id="user_first_name" name="user[first_name]">
    #         </li>
    #       </ol>
    #     </fieldset>
    #   </form>
    #
    # @see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documetation of all possible options.
    class TextInput 
      include Base
      
      def input_html_options
        { 
          :cols => builder.default_text_area_width,
          :rows => builder.default_text_area_height
        }.merge(super)
      end
      
      def to_html
        input_wrapping do
          label_html <<
          builder.text_area(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/text_input.rb
formtastic-2.0.1 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0.rc5 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0.rc4 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0.rc3 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0.rc2 lib/formtastic/inputs/text_input.rb
formtastic-2.0.0.rc1 lib/formtastic/inputs/text_input.rb
nuatt-formtastic-0.2.3 lib/formtastic/inputs/text_input.rb