Sha256: dff526d470aa6d47b36ee85cf5cd9510ef9a32abd74e77a831c3a0f01d5b0416

Contents?: true

Size: 750 Bytes

Versions: 9

Compression:

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

Trestle::Form::Builder.register(:date_select, Trestle::Form::Fields::DateSelect)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trestle-0.8.12 lib/trestle/form/fields/date_select.rb
trestle-0.8.11 lib/trestle/form/fields/date_select.rb
trestle-0.8.10 lib/trestle/form/fields/date_select.rb
trestle-0.8.9 lib/trestle/form/fields/date_select.rb
trestle-0.8.8 lib/trestle/form/fields/date_select.rb
trestle-0.8.7 lib/trestle/form/fields/date_select.rb
trestle-0.8.6 lib/trestle/form/fields/date_select.rb
trestle-0.8.5 lib/trestle/form/fields/date_select.rb
trestle-0.8.4 lib/trestle/form/fields/date_select.rb