Added will paginate to liquid.
This commit is contained in:
parent
e6abd6bbe0
commit
786d2d9693
@ -1 +1,2 @@
|
|||||||
require 'will_paginate/array'
|
require 'will_paginate/array'
|
||||||
|
require 'locomotive/liquid/drops/will_paginate_extension'
|
||||||
|
13
lib/locomotive/liquid/drops/will_paginate_extension.rb
Normal file
13
lib/locomotive/liquid/drops/will_paginate_extension.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class WillPaginate::Collection
|
||||||
|
def to_liquid
|
||||||
|
{
|
||||||
|
:collection => self.to_a,
|
||||||
|
:current_page => current_page,
|
||||||
|
:previous_page => previous_page,
|
||||||
|
:next_page => next_page,
|
||||||
|
:total_entries => total_entries,
|
||||||
|
:total_pages => total_pages,
|
||||||
|
:per_page => per_page
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
@ -38,7 +38,7 @@ module Locomotive
|
|||||||
|
|
||||||
pagination = collection.send(:paginate, {
|
pagination = collection.send(:paginate, {
|
||||||
:page => context['current_page'],
|
:page => context['current_page'],
|
||||||
:per_page => @per_page }).stringify_keys
|
:per_page => @per_page }).to_liquid.stringify_keys
|
||||||
|
|
||||||
page_count, current_page = pagination['total_pages'], pagination['current_page']
|
page_count, current_page = pagination['total_pages'], pagination['current_page']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user