Sha256: 7f2a84b37e2ec1ebbd0c745469170d59357e31a6a2c6efcc8da3d84d6d5c07a2

Contents?: true

Size: 829 Bytes

Versions: 5

Compression:

Stored size: 829 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"], disabled: disabled? || readonly?, data: { enable_select2: true })
        end
      end
    end
  end
end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-0.9.8 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.7 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.6 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.5 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.4 lib/trestle/form/fields/time_zone_select.rb