fix announcement deadline
This commit is contained in:
parent
e7b9e076cc
commit
6df7981ad1
|
@ -7,25 +7,25 @@ class AnnouncementsController < ApplicationController
|
|||
|
||||
if params[:keywords]
|
||||
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
|
||||
announcements = Bulletin.where(:title.ne => "").any_of(:title => /#{params[:keywords].to_s}/i).is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:keywords].nil?
|
||||
announcements = Bulletin.where(:title.ne => "").any_of(:title => /#{params[:keywords].to_s}/i).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:keywords].nil?
|
||||
announcements_count = announcements.count
|
||||
keyword = params[:keywords]
|
||||
elsif params[:unit]
|
||||
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
|
||||
announcements = Bulletin.where(:title.ne => "" ,:cache_dept => params[:unit].to_s).is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:unit].nil?
|
||||
announcements = Bulletin.where(:title.ne => "" ,:cache_dept => params[:unit].to_s).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:unit].nil?
|
||||
announcements_count = announcements.count
|
||||
keyword = params[:unit]
|
||||
elsif params[:tag]
|
||||
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
|
||||
announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]])
|
||||
announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]])
|
||||
else
|
||||
sort = ( !params[:sort].blank? ? {params[:sort].to_sym=>params[:order]} : {:postdate=>"desc"})
|
||||
|
||||
# announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories.filter_by_tags(OrbitHelper.page_tags)
|
||||
if OrbitHelper.page_categories.first == "all"
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_tags.page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
else
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.filter_by_categories.filter_by_tags.can_display.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).can_display.is_approved.filter_by_categories.filter_by_tags.can_display.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count)
|
||||
end
|
||||
end
|
||||
page = Page.where(:module => "announcement").first rescue nil
|
||||
|
|
Reference in New Issue