Sha256: ec9d00f1faf2345fc52e1c1005ff3fb8af8cb73839e9734e18f198296e4d9ea8

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

module ::Formtastic
  module Helpers
    module InputHelper
      alias_method :original_default_input_type, :default_input_type

      def default_input_type(method, options = {})
        input_type = original_default_input_type(method, options)

        if input_type == :date_select && active_admin_context?
          input_type = :datepicker
        end

        input_type
      end

      def active_admin_context?
        options[:builder] == ::ActiveAdmin::FormBuilder
      rescue NameError
        false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeadmin_addons-2.0.0.beta.3 lib/activeadmin_addons/support/set_datepicker.rb
activeadmin_addons-1.10.1 lib/activeadmin_addons/support/set_datepicker.rb
activeadmin_addons-2.0.0.beta.2 lib/activeadmin_addons/support/set_datepicker.rb
activeadmin_addons-2.0.0.beta.0 lib/activeadmin_addons/support/set_datepicker.rb
activeadmin_addons-1.10.0 lib/activeadmin_addons/support/set_datepicker.rb
activeadmin_addons-1.9.0 lib/activeadmin_addons/support/set_datepicker.rb