Remove deprecated code
This commit is contained in:
parent
c8f586c110
commit
548f1bb144
|
@ -1,3 +1,9 @@
|
||||||
|
## 3.0.0.dev
|
||||||
|
|
||||||
|
### enhancements
|
||||||
|
* Support to Rails 4.
|
||||||
|
* Removed deprecated methods.
|
||||||
|
|
||||||
## 2.1.0.dev
|
## 2.1.0.dev
|
||||||
|
|
||||||
### enhancements
|
### enhancements
|
||||||
|
|
|
@ -3,12 +3,6 @@ module SimpleForm
|
||||||
# A collection of methods required by simple_form but added to rails default form.
|
# A collection of methods required by simple_form but added to rails default form.
|
||||||
# This means that you can use such methods outside simple_form context.
|
# This means that you can use such methods outside simple_form context.
|
||||||
module Builder
|
module Builder
|
||||||
# deprecated
|
|
||||||
def collection_radio(*args, &block)
|
|
||||||
SimpleForm.deprecation_warn "The `collection_radio` helper is deprecated, " \
|
|
||||||
"please use `collection_radio_buttons` instead."
|
|
||||||
collection_radio_buttons(*args, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Wrapper for using SimpleForm inside a default rails form.
|
# Wrapper for using SimpleForm inside a default rails form.
|
||||||
# Example:
|
# Example:
|
||||||
|
|
|
@ -362,12 +362,6 @@ module SimpleForm
|
||||||
column = find_attribute_column(attribute_name)
|
column = find_attribute_column(attribute_name)
|
||||||
input_type = default_input_type(attribute_name, column, options)
|
input_type = default_input_type(attribute_name, column, options)
|
||||||
|
|
||||||
if input_type == :radio
|
|
||||||
SimpleForm.deprecation_warn "Using `:as => :radio` as input type is " \
|
|
||||||
"deprecated, please change it to `:as => :radio_buttons`."
|
|
||||||
input_type = :radio_buttons
|
|
||||||
end
|
|
||||||
|
|
||||||
if block_given?
|
if block_given?
|
||||||
SimpleForm::Inputs::BlockInput.new(self, attribute_name, column, input_type, options, &block)
|
SimpleForm::Inputs::BlockInput.new(self, attribute_name, column, input_type, options, &block)
|
||||||
else
|
else
|
||||||
|
|
|
@ -46,18 +46,6 @@ module SimpleForm
|
||||||
end
|
end
|
||||||
|
|
||||||
def use(name, options=nil, &block)
|
def use(name, options=nil, &block)
|
||||||
if block_given?
|
|
||||||
ActiveSupport::Deprecation.warn "Passing a block to use is deprecated. " \
|
|
||||||
"Please use wrapper instead of use."
|
|
||||||
return wrapper(name, options, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
if options && options.keys != [:wrap_with]
|
|
||||||
ActiveSupport::Deprecation.warn "Passing :tag, :class and others to use is deprecated. " \
|
|
||||||
"Please invoke b.use #{name.inspect}, :wrap_with => #{options.inspect} instead."
|
|
||||||
options = { :wrap_with => options }
|
|
||||||
end
|
|
||||||
|
|
||||||
if options && wrapper = options[:wrap_with]
|
if options && wrapper = options[:wrap_with]
|
||||||
@components << Single.new(name, wrapper)
|
@components << Single.new(name, wrapper)
|
||||||
else
|
else
|
||||||
|
@ -66,18 +54,6 @@ module SimpleForm
|
||||||
end
|
end
|
||||||
|
|
||||||
def optional(name, options=nil, &block)
|
def optional(name, options=nil, &block)
|
||||||
if block_given?
|
|
||||||
ActiveSupport::Deprecation.warn "Passing a block to optional is deprecated. " \
|
|
||||||
"Please use wrapper instead of optional."
|
|
||||||
return wrapper(name, options, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
if options && options.keys != [:wrap_with]
|
|
||||||
ActiveSupport::Deprecation.warn "Passing :tag, :class and others to optional is deprecated. " \
|
|
||||||
"Please invoke b.optional #{name.inspect}, :wrap_with => #{options.inspect} instead."
|
|
||||||
options = { :wrap_with => options }
|
|
||||||
end
|
|
||||||
|
|
||||||
@options[name] = false
|
@options[name] = false
|
||||||
use(name, options, &block)
|
use(name, options, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -242,18 +242,6 @@ class BuilderTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'collection_radio helper is deprecated in favor of collection_radio_buttons' do
|
|
||||||
assert_deprecated "[SIMPLE_FORM] The `collection_radio` helper is deprecated, " \
|
|
||||||
"please use `collection_radio_buttons` instead" do
|
|
||||||
with_concat_form_for(@user) do |f|
|
|
||||||
f.collection_radio :active, [true, false], :to_s, :to_s
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_select 'input[type=radio][value=true]'
|
|
||||||
assert_select 'input[type=radio][value=false]'
|
|
||||||
end
|
|
||||||
|
|
||||||
# COLLECTION CHECK BOX
|
# COLLECTION CHECK BOX
|
||||||
test 'collection check box accepts a collection and generate a serie of checkboxes for value method' do
|
test 'collection check box accepts a collection and generate a serie of checkboxes for value method' do
|
||||||
collection = [Tag.new(1, 'Tag 1'), Tag.new(2, 'Tag 2')]
|
collection = [Tag.new(1, 'Tag 1'), Tag.new(2, 'Tag 2')]
|
||||||
|
|
|
@ -6,15 +6,6 @@ class CollectionRadioButtonsInputTest < ActionView::TestCase
|
||||||
SimpleForm::Inputs::CollectionRadioButtonsInput.reset_i18n_cache :boolean_collection
|
SimpleForm::Inputs::CollectionRadioButtonsInput.reset_i18n_cache :boolean_collection
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'input :as => :radio is deprecated in favor of :as => :radio_buttons' do
|
|
||||||
assert_deprecated "[SIMPLE_FORM] Using `:as => :radio` as " \
|
|
||||||
"input type is deprecated, please change it to `:as => :radio_buttons`." do
|
|
||||||
with_input_for @user, :active, :radio
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_select 'input[type=radio].radio_buttons', :count => 2
|
|
||||||
end
|
|
||||||
|
|
||||||
test 'input should generate boolean radio buttons by default for radio types' do
|
test 'input should generate boolean radio buttons by default for radio types' do
|
||||||
with_input_for @user, :active, :radio_buttons
|
with_input_for @user, :active, :radio_buttons
|
||||||
assert_select 'input[type=radio][value=true].radio_buttons#user_active_true'
|
assert_select 'input[type=radio][value=true].radio_buttons#user_active_true'
|
||||||
|
|
Loading…
Reference in New Issue