Fixed Mobile Site

This commit is contained in:
saurabhbhatia 2013-12-04 18:07:27 +08:00
parent 62bc66ab07
commit 947c907f73
1 changed files with 6 additions and 8 deletions

View File

@ -5,21 +5,19 @@ class MobileController < ApplicationController
before_filter :no_footer_for_app before_filter :no_footer_for_app
def index def index
@site = Site.first
date_now = Time.now 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] @ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0]
end end
def announcement def announcement
@module = ModuleApp.where(:key => "announcement").first @site = Site.first
category=[] category = @site.announcement_category
@module.categories.each do |c|
puts category << c.id.to_s
end
@page_title = t('mobile.bulletin') @page_title = t('mobile.bulletin')
date_now = Time.now 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) # @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 end