Compare commits

..

1 Commits

Author SHA1 Message Date
Spen 0b14da0fd8 announcement init sorting fix 2013-10-07 15:09:27 +08:00
1 changed files with 1 additions and 9 deletions

View File

@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page
@page_title = t('mobile.page')
@page_contexts = get_sorted_page_from_structure
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15)
end
def page_content
@ -57,12 +57,4 @@ class MobileController < ApplicationController
@no_footer = true if request.path =~ /app/
end
def get_sorted_page_from_structure
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
pages
}
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
end
end