Compare commits

...

2 Commits

Author SHA1 Message Date
chris f8bb0bba56 Display de page contexts in the mobile version as set in structure 2013-10-08 18:10:55 +08:00
Spen 47b8b3e277 announcement init sorting fix 2013-10-07 15:33:50 +08:00
2 changed files with 10 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page
@page_title = t('mobile.page')
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15)
@page_contexts = get_sorted_page_from_structure
end
def page_content
@ -57,4 +57,12 @@ 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

View File

@ -29,7 +29,7 @@ module Announcement
widgets do
default_widget do
sorting 'desc(:postdate)'
sorting 'desc(:is_top, :postdate)'
query 'Bulletin.can_display.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
enable ["typeA","typeB_style3","typeC"]
image :image