fix deadline & add word

This commit is contained in:
nccu 2014-12-30 09:49:18 +08:00
parent 6df7981ad1
commit 5b0e1aed02
2 changed files with 7 additions and 5 deletions

View File

@ -7,25 +7,25 @@ class AnnouncementsController < ApplicationController
if params[:keywords] if params[:keywords]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} !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).can_display.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).is_approved.order_by(sort).filter_by_categories(["all"]).per(15) if !params[:keywords].nil?
announcements_count = announcements.count announcements_count = announcements.count
keyword = params[:keywords] keyword = params[:keywords]
elsif params[:unit] elsif params[:unit]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
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 = 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_count = announcements.count announcements_count = announcements.count
keyword = params[:unit] keyword = params[:unit]
elsif params[:tag] elsif params[:tag]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"} !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
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]]) announcements = Bulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_categories(["all"]).filter_by_tags([params[:tag]])
else else
sort = ( !params[:sort].blank? ? {params[:sort].to_sym=>params[:order]} : {:postdate=>"desc"}) 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) # 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" if OrbitHelper.page_categories.first == "all"
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) 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)
else else
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) announcements = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]).is_approved.filter_by_categories.filter_by_tags.order_by(sort).page(params[:page_no]).per(OrbitHelper.page_data_count)
end end
end end
page = Page.where(:module => "announcement").first rescue nil page = Page.where(:module => "announcement").first rescue nil

View File

@ -125,6 +125,8 @@
※內文裡單一圖片大小為1MB以下。 ※內文裡單一圖片大小為1MB以下。
<br /> <br />
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。 ※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
<br />
※新聞及公告發佈後台請增加下列文字建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。
</div> </div>
<div class="textarea"> <div class="textarea">
<%= f.fields_for :text_translations do |f| %> <%= f.fields_for :text_translations do |f| %>