Skip to content
Browse files

Override only the component rendering method.

  • Loading branch information...
1 parent dc212a5 commit c8f586c11094f3a9c9fd99dab89453c3828b9d94 @rafaelfranca rafaelfranca committed Dec 26, 2012
Showing with 3 additions and 29 deletions.
  1. +1 −1 Gemfile.lock
  2. +2 −28 lib/simple_form/action_view_extensions/builder.rb
View
2 Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/rails/rails.git
- revision: ceedec7edcadbad824f58e84bc2c1eddbe8539ce
+ revision: 42d9b480121e15a15cddd2015a1e60a0f9e0f953
branch: master
specs:
actionpack (4.0.0.beta)
View
30 lib/simple_form/action_view_extensions/builder.rb
@@ -71,17 +71,7 @@ class CollectionRadioButtons < ActionView::Helpers::Tags::CollectionRadioButtons
include CollectionExtensions
def render
- rendered_collection = render_collection do |item, value, text, default_html_options|
- builder = instantiate_builder(RadioButtonBuilder, item, value, text, default_html_options)
-
- if block_given?
- yield builder
- else
- render_component(builder)
- end
- end
-
- wrap_rendered_collection(rendered_collection, @options)
+ wrap_rendered_collection(super, @options)
end
private
@@ -95,22 +85,7 @@ class CollectionCheckBoxes < ActionView::Helpers::Tags::CollectionCheckBoxes
include CollectionExtensions
def render
- rendered_collection = render_collection do |item, value, text, default_html_options|
- default_html_options[:multiple] = true
- builder = instantiate_builder(CheckBoxBuilder, item, value, text, default_html_options)
-
- if block_given?
- yield builder
- else
- render_component(builder)
- end
- end
-
- # Append a hidden field to make sure something will be sent back to the
- # server if all check boxes are unchecked.
- hidden = @template_object.hidden_field_tag("#{tag_name}[]", "", :id => nil)
-
- wrap_rendered_collection(rendered_collection + hidden, @options)
+ wrap_rendered_collection(super, @options)
end
private
@@ -227,7 +202,6 @@ def collection_radio_buttons(method, collection, value_method, text_method, opti
# * item_wrapper_class => the CSS class to use for item_wrapper_tag
#
# * a block => to generate the label + check box or any other component.
- #
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
SimpleForm::Tags::CollectionCheckBoxes.new(@object_name, method, @template, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)).render(&block)
end

0 comments on commit c8f586c

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