Module: LightScroll::ActionView

Defined in:
lib/light_scroll.rb

Instance Method Summary collapse

Instance Method Details

#light_scroll(collection, path, params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/light_scroll.rb', line 9

def light_scroll(collection, path, params)
  params[:page] = params[:page].present? ? params[:page].to_i + 1 : 2
  if collection.next_page
    %{

      <div class="more-items">
        <a class="view-more" data-remote="true" href="#{path}?#{params.permit(params.keys).to_hash.map{|k,v| "#{k}=#{v}"}.join("&")}" />
      </div>

    }.html_safe
  end
end