Sha256: c50765e759511988beb2a7fccfb35b0f410ca0680f48496a51fae1fe12bbe52e

Contents?: true

Size: 1.1 KB

Versions: 60

Compression:

Stored size: 1.1 KB

Contents

#timeish.rb
module FormtasticBootstrap
  module Inputs
    module Base
      module Timeish

        def date_input_html
          current_value = @object.send(method)
          opts = input_html_options.merge({ :size => 24,
             :class => "datepicker",
             :max => 10,
             :readonly => 'readonly',
             :value => current_value.respond_to?(:strftime) ? current_value.strftime("%Y-%m-%d") : ""
             })
           builder.text_field(method, opts)
        end

        def time_input_html
           time_fragments.map do |fragment|
              fragment_input_html(fragment, "mini")
            end.join.html_safe
        end

        def fragment_input_html(fragment, klass)
          klass ||= ""
          klass += " datetime-selector"
          
          opts = input_options.merge(:prefix => fragment_prefix, :field_name => fragment_name(fragment), :default => value, :include_blank => include_blank?)
          template.send(:"select_#{fragment}", value, opts, input_html_options.merge(:id => fragment_id(fragment), :class => klass.strip))
        end

      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
fullstack-admin-0.2.5 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.2.4 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.2.3 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.2.2 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.2.1 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.56 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.55 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.54 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.53 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.52 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.51 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.50 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.49 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.48 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.47 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.46 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.45 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.44 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.43 config/initializers/formtastic_bootstrap_timeish_hack.rb
fullstack-admin-0.1.42 config/initializers/formtastic_bootstrap_timeish_hack.rb