From 947c907f7359ad8986292c65357455b1901a20de Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Wed, 4 Dec 2013 18:07:27 +0800 Subject: [PATCH] Fixed Mobile Site --- app/controllers/mobile_controller.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/controllers/mobile_controller.rb b/app/controllers/mobile_controller.rb index 9d3cfeae..163f3143 100644 --- a/app/controllers/mobile_controller.rb +++ b/app/controllers/mobile_controller.rb @@ -5,21 +5,19 @@ class MobileController < ApplicationController before_filter :no_footer_for_app def index - @site = Site.first date_now = Time.now - @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) + @site = Site.first + category = @site.announcement_category + @bulletins = Bulletin.where(:category_id.in => category).available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) @ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0] end def announcement - @module = ModuleApp.where(:key => "announcement").first - category=[] - @module.categories.each do |c| - puts category << c.id.to_s - end + @site = Site.first + category = @site.announcement_category @page_title = t('mobile.bulletin') date_now = Time.now - bulletin = Bulletin.where(:category_id.in => category).available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) + @bulletins = Bulletin.where(:category_id.in => category).available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) # @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) end