fix deadline & add word

This commit is contained in:
nccu 2014-12-30 09:50:33 +08:00
parent 1dcbb4948e
commit 7369b72f3e
2 changed files with 7 additions and 5 deletions

View File

@ -6,13 +6,13 @@ class NewsController < ApplicationController
if params[:keywords]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
news = NewsBulletin.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?
news = NewsBulletin.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?
news_count = news.count
keyword = params[:keywords]
elsif params[:department]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
dept = Department.find_by(:uid => params["department"].split("-").last) rescue nil
news = NewsBulletin.where(:title.ne => "" ,:department => dept).can_display.is_approved.order_by(sort).filter_by_categories(["all"]) if !dept.nil?
news = NewsBulletin.where(:title.ne => "" ,:department => dept).is_approved.order_by(sort).filter_by_categories(["all"]) if !dept.nil?
news_count = news.count
keywords = params[:department].split("-")
@ -26,7 +26,7 @@ class NewsController < ApplicationController
elsif params[:unit]
unit = Unit.find_by(:uid => params["unit"].split("-").last) rescue nil
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
news = NewsBulletin.where(:title.ne => "" ,:unit => unit).can_display.is_approved.order_by(sort).filter_by_categories(["all"]) if !unit.nil?
news = NewsBulletin.where(:title.ne => "" ,:unit => unit).is_approved.order_by(sort).filter_by_categories(["all"]) if !unit.nil?
news_count = news.count
keywords = params[:unit].split("-")
@ -39,7 +39,7 @@ class NewsController < ApplicationController
elsif params["category"]
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
category = Category.find_by(:uid => params["category"].split("-").last) rescue nil
news = NewsBulletin.all.where(:title.ne => "").can_display.is_approved.order_by(sort).filter_by_categories([category.id.to_s]) if !category.nil?
news = NewsBulletin.all.where(:title.ne => "").is_approved.order_by(sort).filter_by_categories([category.id.to_s]) if !category.nil?
news_count = news.count
keywords = params[:category].split("-")
@ -51,7 +51,7 @@ class NewsController < ApplicationController
end
end
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:postdate=>"desc"}
news = NewsBulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).can_display.is_approved.order_by(sort).filter_by_categories.filter_by_tags(OrbitHelper.params['tags']) if news.nil?
news = NewsBulletin.where(:title.ne => "" ,:is_preview.in=>[false,nil]).is_approved.order_by(sort).filter_by_categories.filter_by_tags(OrbitHelper.params['tags']) if news.nil?
page = Page.where(:module => "news").first rescue nil
ma = ModuleApp.find_by_key("news") rescue nil
categories = ma.categories.enabled.collect do |cat|

View File

@ -218,6 +218,8 @@
<br />
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
<br />
※新聞及公告發佈後台請增加下列文字建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。
<br />
<a href="https://www.safesync.nccu.edu.tw/HWwc/%E5%A6%82%E4%BD%95%E8%A3%81%E5%89%AA%E6%96%B0%E8%81%9E%E5%9C%96%E7%89%87.pdf?a=tAdpdijUy1U" target="_blank" style="color:red;">※如何剪裁新聞圖片。</a>
</div>
<div class="textarea">