Method: Olivander::ApplicationHelper#collection_component_builder_for

Defined in:
app/helpers/olivander/application_helper.rb

#collection_component_builder_for(klass, collection, *args, &block) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'app/helpers/olivander/application_helper.rb', line 213

def collection_component_builder_for(klass, collection, *args, &block)
  builder = klass::Builder.new(self, &block)
  options = args.extract_options!
  options[:builder] = builder
  render klass.new(collection, *(args + [options])) do |component|
    if builder.header_tools.present?
      component.with_header_tools do
        builder.header_tools.call
      end
    end
    if builder.footer_buttons.present?
      component.with_footer_buttons do
        builder.footer_buttons.call
      end
    end
  end
end