Module: Puffer::Helpers::ComponentHelper

Defined in:
lib/puffer/helpers/component_helper.rb

Instance Method Summary collapse

Instance Method Details

#component_fields_for(record, &block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/puffer/helpers/component_helper.rb', line 14

def component_fields_for record, &block
  if opts[:builder]
    capture opts[:builder], &block
  else
    fields_for record, &block
  end
end

#component_wrap(name = :span, options = {}, &block) ⇒ Object



5
6
7
# File 'lib/puffer/helpers/component_helper.rb', line 5

def component_wrap name = :span, options = {}, &block
   name, options.merge(:id => component_id), &block
end

#paginate(scope, options = {}, &block) ⇒ Object



9
10
11
12
# File 'lib/puffer/helpers/component_helper.rb', line 9

def paginate(scope, options = {}, &block)
  paginator = Kaminari::Helpers::Paginator.new parent_controller.view_context, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :param_name => Kaminari.config.param_name, :remote => false)
  paginator.to_s
end