Sha256: 8518f2133a74d892607e3d07bb0b77f7a97badf85435088193563dcf504163aa

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-0.9.3 lib/trestle/form/fields/time_zone_select.rb
trestle-0.9.2 lib/trestle/form/fields/time_zone_select.rb