Sha256: aaadeb0156170613651d64fe126642f24a7310e736d00adcd00c33c473ed2f45

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 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"])
        end
      end
    end
  end
end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trestle-0.8.3 lib/trestle/form/fields/time_select.rb
trestle-0.8.2 lib/trestle/form/fields/time_select.rb
trestle-0.8.0 lib/trestle/form/fields/time_select.rb