Sha256: 8ba5875a07284adaf5cb1c4967aebdf790a981f87ca3e05d12cfc990e57eb9c0

Contents?: true

Size: 748 Bytes

Versions: 11

Compression:

Stored size: 748 Bytes

Contents

module ActiveAdmin
  module Inputs
    class DatepickerInput < ::Formtastic::Inputs::StringInput
      def input_html_options
        super.tap do |options|
          options[:class] = [options[:class], "datepicker"].compact.join(' ')
          options[:data] ||= {}
          options[:data].merge! datepicker_options
        end
      end

      # Can pass proc to filter label option
      def label_from_options
        res = super
        res = res.call if res.is_a? Proc
        res
      end

      private
      def datepicker_options
        options = self.options.fetch(:datepicker_options, {})
        options = Hash[options.map{ |k, v| [k.to_s.camelcase(:lower), v] }]
        { datepicker_options: options }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rails-1.7.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rb-1.6.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rb-1.5.2 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rb-1.5.1 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rb-1.5.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-rb-1.4.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-1.4.3 lib/active_admin/inputs/datepicker_input.rb
activeadmin-1.4.2 lib/active_admin/inputs/datepicker_input.rb
activeadmin-1.4.1 lib/active_admin/inputs/datepicker_input.rb
activeadmin-1.4.0 lib/active_admin/inputs/datepicker_input.rb