Revert "Arrays now paginate correctly."

This reverts commit 25441ff60a.
This commit is contained in:
Mario Visic 2011-10-24 23:34:43 +08:00
parent 25441ff60a
commit 2bb9f5ed05
5 changed files with 13 additions and 24 deletions

View File

@ -1,5 +0,0 @@
class Array
def to_liquid
Locomotive::Liquid::Drops::Base.new(self)
end
end

View File

@ -30,23 +30,6 @@ module Locomotive
records
end
def paginate(options = {})
@collection = self.collection.paginate(options)
{
:collection => @collection,
:current_page => @collection.current_page,
:previous_page => @collection.previous_page,
:next_page => @collection.next_page,
:total_entries => @collection.total_entries,
:total_pages => @collection.total_pages,
:per_page => @collection.per_page
}
end
def collection
@_source
end
protected
def liquify(*records, &block)

View File

@ -63,6 +63,19 @@ module Locomotive
protected
def paginate(options = {})
@collection = self.collection.paginate(options)
{
:collection => @collection,
:current_page => @collection.current_page,
:previous_page => @collection.previous_page,
:next_page => @collection.next_page,
:total_entries => @collection.total_entries,
:total_pages => @collection.total_pages,
:per_page => @collection.per_page
}
end
def collection
@collection ||= @content_type.ordered_contents(@context['with_scope'])
end

View File

@ -43,7 +43,6 @@ module Locomotive
page_count, current_page = pagination['total_pages'], pagination['current_page']
path = context.registers[:page].fullpath
path = context['path']
pagination['previous'] = link(I18n.t('pagination.previous'), current_page - 1, path) if pagination['previous_page']
pagination['next'] = link(I18n.t('pagination.next'), current_page + 1, path) if pagination['next_page']

View File

@ -65,7 +65,6 @@ module Locomotive
'contents' => Locomotive::Liquid::Drops::Contents.new,
'current_page' => self.params[:page],
'params' => self.params,
'path' => request.path,
'url' => request.url,
'now' => Time.now.utc,
'today' => Date.today