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