Skip to content
Browse files

removed a bunch of deprecated methods and options

  • Loading branch information...
1 parent aeaf542 commit 41408c85a0f9c49f85123b9240f170ee5c4b2a6e @justinfrench committed
Showing with 3 additions and 54 deletions.
  1. +3 −27 lib/formtastic.rb
  2. +0 −27 spec/commit_button_spec.rb
View
30 lib/formtastic.rb
@@ -295,11 +295,6 @@ def inputs(*args, &block)
end
end
- def input_field_set(*args, &block)
- ::ActiveSupport::Deprecation.warn("input_field_set() is deprecated and will be removed in Formtastic 1.3 or later, use inputs() instead.", caller)
- inputs(args, &block)
- end
-
# Creates a fieldset and ol tag wrapping for form buttons / actions as list items.
# See inputs documentation for a full example. The fieldset's default class attriute
# is set to "buttons".
@@ -318,11 +313,6 @@ def buttons(*args, &block)
end
end
- def button_field_set(*args, &block)
- ::ActiveSupport::Deprecation.warn("button_field_set() is deprecated and will be removed in Formtastic 1.3 or later, use inputs() instead.", caller)
- buttons(args, &block)
- end
-
# Creates a submit input tag with the value "Save [model name]" (for existing records) or
# "Create [model name]" (for new records) by default:
#
@@ -335,15 +325,11 @@ def button_field_set(*args, &block)
#
# And you can pass html atributes down to the input, with or without the button text:
#
- # <%= form.commit_button "Go" %> => <input name="commit" type="submit" value="Go" class="{create|update|submit}" />
- # <%= form.commit_button :class => "pretty" %> => <input name="commit" type="submit" value="Save Post" class="pretty {create|update|submit}" />
- #
+ # <%= form.commit_button :button_html => { :class => "pretty" } %> => <input name="commit" type="submit" value="Save Post" class="pretty {create|update|submit}" />
def commit_button(*args)
options = args.extract_options!
- ::ActiveSupport::Deprecation.warn(":class => 'whatever' is deprecated on commit button, use :wrapper_html => { :class => 'whatever' } instead.", caller) if options.key?(:class)
text = options.delete(:label) || args.shift
-
if @object && (@object.respond_to?(:persisted?) || @object.respond_to?(:new_record?))
if @object.respond_to?(:persisted?) # ActiveModel
key = @object.persisted? ? :update : :create
@@ -374,7 +360,7 @@ def commit_button(*args)
button_html = options.delete(:button_html) || {}
button_html.merge!(:class => [button_html[:class], key].compact.join(' '))
- wrapper_html_class = ['commit', options.delete(:class)].compact # TODO: Add class reflecting on form action.
+ wrapper_html_class = ['commit'] # TODO: Add class reflecting on form action.
wrapper_html = options.delete(:wrapper_html) || {}
wrapper_html[:class] = (wrapper_html_class << wrapper_html[:class]).flatten.compact.join(' ')
@@ -594,7 +580,7 @@ def inputs_for_nested_attributes(*args, &block) #:nodoc:
#
def strip_formtastic_options(options) #:nodoc:
options.except(:value_method, :label_method, :collection, :required, :label,
- :as, :hint, :input_html, :label_html, :value_as_class, :find_options)
+ :as, :hint, :input_html, :label_html, :value_as_class, :find_options, :class)
end
# Determins if the attribute (eg :title) should be considered required or not.
@@ -852,11 +838,6 @@ def select_input(method, options)
self.label(method, label_options) << select_html
end
- def boolean_select_input(method, options)
- ::ActiveSupport::Deprecation.warn(":as => :boolean_select is deprecated and will be removed in Formtastic 1.3 or later. Use :as => :select instead.", caller)
- select_input(method, options)
- end
-
# Outputs a timezone select input as Rails' time_zone_select helper. You
# can give priority zones as option.
#
@@ -960,11 +941,6 @@ def radio_input(method, options)
)
end
- def boolean_radio_input(method, options)
- ::ActiveSupport::Deprecation.warn(":as => :boolean_radio is deprecated and will be removed in Formtastic 1.3 or later. Use :as => :radio instead.", caller)
- radio_input(method, options)
- end
-
# Outputs a fieldset with a legend for the method label, and a ordered list (ol) of list
# items (li), one for each fragment for the date (year, month, day). Each li contains a label
# (eg "Year") and a select box. Overwriting the label is possible by adding the :labels option.
View
27 spec/commit_button_spec.rb
@@ -464,33 +464,6 @@ def self.human_name
output_buffer.should have_tag("form li.my_class")
output_buffer.should have_tag("form li.another_class")
end
-
- it 'should merge in classes applied using the :class option' do
- with_deprecation_silenced do
- form = semantic_form_for(@new_post) do |builder|
- concat(builder.commit_button('text', :class => 'from_class_option', :wrapper_html => {:class => 'from_wrapper_html'}, :button_html => { :class => 'from_button_html'}))
- end
- output_buffer.concat(form) if Formtastic::Util.rails3?
- output_buffer.should have_tag("form li.commit")
- output_buffer.should have_tag("form li.from_wrapper_html")
- output_buffer.should have_tag("form li.from_class_option")
- output_buffer.should have_tag("form li input.from_button_html")
- output_buffer.should_not have_tag("form li.from_button_html")
- end
- end
-
- it 'should warn that :class is a deprecated option' do
- with_deprecation_silenced do
- ::ActiveSupport::Deprecation.should_receive(:warn).any_number_of_times
- @form = semantic_form_for(@new_post) do |builder|
- concat(builder.commit_button('text', :class => 'from_button_html', :wrapper_html => {:class => 'from_wrapper_html'}))
- end
- end
- output_buffer.concat(@form) if Formtastic::Util.rails3?
- output_buffer.should have_tag("form li.commit")
- output_buffer.should have_tag("form li.from_button_html")
- output_buffer.should have_tag("form li.from_wrapper_html")
- end
end
describe 'when not provided' do

0 comments on commit 41408c8

Please sign in to comment.
Something went wrong with that request. Please try again.