Sha256: fa80b615af32dc33ec82e0c465aa6b2e79f062e17f302b7952839aa79ff5f25d

Contents?: true

Size: 771 Bytes

Versions: 7

Compression:

Stored size: 771 Bytes

Contents

module Trestle
  class Form
    module Fields
      class TimeSelect < Field
        attr_reader :html_options

        def initialize(builder, template, name, options={}, html_options={}, &block)
          super(builder, template, name, options, &block)

          @html_options = default_html_options.merge(html_options)
        end

        def field
          content_tag(:div, class: "time-select") do
            builder.raw_time_select(name, options, html_options, &block)
          end
        end

        def default_html_options
          Trestle::Options.new(class: ["form-control"], disabled: readonly?, data: { enable_select2: true })
        end
      end
    end
  end
end

Trestle::Form::Builder.register(:time_select, Trestle::Form::Fields::TimeSelect)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trestle-0.9.8 lib/trestle/form/fields/time_select.rb
trestle-0.9.7 lib/trestle/form/fields/time_select.rb
trestle-0.9.6 lib/trestle/form/fields/time_select.rb
trestle-0.9.5 lib/trestle/form/fields/time_select.rb
trestle-0.9.4 lib/trestle/form/fields/time_select.rb
trestle-0.9.3 lib/trestle/form/fields/time_select.rb
trestle-0.9.2 lib/trestle/form/fields/time_select.rb