Sha256: c55771ea82db1113f95d5895ea843ba92ff44626466b94baf096013b56f799b9

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 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-select"], disabled: disabled? || readonly?, data: { controller: "select" })
        end
      end
    end
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.10.1 lib/trestle/form/fields/time_zone_select.rb
trestle-0.10.0 lib/trestle/form/fields/time_zone_select.rb
trestle-0.10.0.pre2 lib/trestle/form/fields/time_zone_select.rb
trestle-0.10.0.pre lib/trestle/form/fields/time_zone_select.rb