Sha256: 073ecbb70255b7e97334218044054ed173dab99d75c8418d302567e9dd3719ed

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 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: admin.readonly?, data: { enable_select2: true })
        end
      end
    end
  end
end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trestle-0.9.1 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.0 lib/trestle/form/fields/time_zone_select.rb
trestle-0.8.13 lib/trestle/form/fields/time_zone_select.rb