2010-07-06 09:24:12 +00:00
|
|
|
module SimpleForm
|
|
|
|
module Components
|
|
|
|
module LabelInput
|
2011-09-03 12:40:47 +00:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
include SimpleForm::Components::Labels
|
2010-07-06 09:24:12 +00:00
|
|
|
end
|
|
|
|
|
2014-03-11 22:41:25 +00:00
|
|
|
def label_input(wrapper_options = nil)
|
2014-03-11 19:10:26 +00:00
|
|
|
if options[:label] == false
|
2014-03-11 22:41:25 +00:00
|
|
|
deprecated_component(:input, wrapper_options)
|
2014-03-11 18:54:18 +00:00
|
|
|
else
|
2014-03-11 22:41:25 +00:00
|
|
|
deprecated_component(:label, wrapper_options) + deprecated_component(:input, wrapper_options)
|
2014-03-11 18:54:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-11 19:10:26 +00:00
|
|
|
private
|
|
|
|
|
2014-03-11 22:41:25 +00:00
|
|
|
def deprecated_component(namespace, wrapper_options)
|
2014-03-11 19:10:26 +00:00
|
|
|
method = method(namespace)
|
2014-03-11 18:54:18 +00:00
|
|
|
|
|
|
|
if method.arity == 0
|
2014-03-11 19:10:26 +00:00
|
|
|
ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
|
2014-03-11 18:54:18 +00:00
|
|
|
|
|
|
|
method.call
|
|
|
|
else
|
2014-03-11 22:41:25 +00:00
|
|
|
method.call(wrapper_options)
|
2014-03-11 18:54:18 +00:00
|
|
|
end
|
2010-07-06 09:24:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-09-03 12:40:47 +00:00
|
|
|
end
|