Sha256: 2fcf3410871900fb9c5bb449b32168cbba7bf0a4e797a3abc8236d97a433a6a5

Contents?: true

Size: 795 Bytes

Versions: 9

Compression:

Stored size: 795 Bytes

Contents

module Trestle
  class Form
    module Fields
      class TimeZoneSelect < Field
        attr_reader :priority_zones, :html_options

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

          @priority_zones = priority_zones
          @html_options = default_html_options.merge(html_options)
        end

        def field
          builder.raw_time_zone_select(name, priority_zones, options, html_options, &block)
        end

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

Trestle::Form::Builder.register(:time_zone_select, Trestle::Form::Fields::TimeZoneSelect)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trestle-0.8.12 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.11 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.10 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.9 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.8 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.7 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.6 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.5 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.4 lib/trestle/form/fields/time_zone_select.rb