Sha256: 73551b5b7ea7b73408aea98c31e342819c3aca0ee17a9d1e262bdd4f73a59fa2

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

module FormtasticBootstrap
  module Inputs
    module Base
      module Timeish

        def label_html
          # TODO Supress the "for" field?
          template.content_tag(:label, label_html_options) do
            render_label? ? label_text : "".html_safe
          end
        end

        def date_input_html
          fragment_input_html(:date, "small")
        end

        def time_input_html
          fragment_input_html(:time, "mini")
        end
        
        def fragment_id(fragment)
          # TODO is this right?
          # "#{input_html_options[:id]}_#{position(fragment)}i"
          "#{input_html_options[:id]}[#{fragment}]"
        end
        
        def fragment_input_html(fragment, klass)
          opts = input_options.merge(:prefix => object_name, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?)
          template.send(:"text_field_#{fragment}", value, opts, input_html_options.merge(:id => fragment_id(fragment), :class => klass))
        end
     
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
speedo-formstrap-1.2.7 lib/formtastic-bootstrap/inputs/base/timeish.rb
speedo-formstrap-1.2.6 lib/formtastic-bootstrap/inputs/base/timeish.rb
speedo-formstrap-1.2.5 lib/formtastic-bootstrap/inputs/base/timeish.rb
speedo-formstrap-1.2.4 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.2.0 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.1.2 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.1.1 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.1.0 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.0.3 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.0.2 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.0.1 lib/formtastic-bootstrap/inputs/base/timeish.rb
formtastic-bootstrap-1.0.0 lib/formtastic-bootstrap/inputs/base/timeish.rb