Sha256: 5a24c3915448dde2c259d4b2e25e9dd9a51bbb83e7777eb6ff22ffdcc605740c

Contents?: true

Size: 777 Bytes

Versions: 3

Compression:

Stored size: 777 Bytes

Contents

module Trestle
  class Form
    module Fields
      class DateSelect < Field
        attr_reader :html_options

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

          @html_options = default_html_options.merge(html_options)
        end

        def field
          content_tag(:div, class: "date-select") do
            builder.raw_date_select(name, options, html_options, &block)
          end
        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(:date_select, Trestle::Form::Fields::DateSelect)

Version data entries

3 entries across 3 versions & 1 rubygems

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