Module: CornStarch::InfiniscrollHelper
- Defined in:
- app/helpers/corn_starch/infiniscroll_helper.rb
Overview
InfiniScroll Helper
Instance Method Summary collapse
-
#infiniscroll_container(id, target, template = nil, extra_args = nil, n = 1) ⇒ Object
InfiniScroll Container.
Instance Method Details
#infiniscroll_container(id, target, template = nil, extra_args = nil, n = 1) ⇒ Object
InfiniScroll Container
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/corn_starch/infiniscroll_helper.rb', line 11 def infiniscroll_container id, target, template = nil, extra_args = nil, n = 1 # Prep Args first = true args = '' # Include Search Params if @infiniscroll[:params][:search] args = args + (first ? '?' : '&') + "search=#{@infiniscroll[:params][:search]}" first = false end # Include Pagination - Records Per Page if @infiniscroll[:params][:records_per_page] args = args + (first ? '?' : '&') + "records_per_page=#{@infiniscroll[:params][:records_per_page]}" first = false end args = args + (first ? '?' : '&') + extra_args.to_query if extra_args # Produce Container div_tag id: id, class: 'infiniscroll-container', 'infiniscroll-trgt' => target, 'infiniscroll-args' => args, 'infiniscroll-next' => n, 'infiniscroll-margin' => CORNSTARCH_CONF[:infiniscroll][:margin] do if template render partial: template.to_s, locals: extra_args else yield extra_args if block_given? end end end |