fix search word & back page notice word

This commit is contained in:
nccu 2015-01-05 15:21:44 +08:00
parent 5b0e1aed02
commit 66b37d17ee
2 changed files with 23 additions and 5 deletions

View File

@ -9,15 +9,33 @@ class AnnouncementsController < ApplicationController
!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_count = announcements.count
keyword = params[:keywords]
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_count = announcements.count
keyword = params[:unit]
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]])
keyword = "搜尋有關 ' " + Tag.where(:id => params[:tag]).first.name + " '"
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
announcements = Bulletin.all.where(:title.ne => "").is_approved.order_by(sort).filter_by_categories([category.id.to_s]) if !category.nil?
announcements_count = announcements.count
keywords = params[:category].split("-")
keywords.delete(keywords.last)
if keywords.kind_of?(Array)
keyword = "搜尋有關 ' " + keywords.join("-") + " '"
else
keyword = "搜尋有關 ' " + keywords + " '"
end
else
sort = ( !params[:sort].blank? ? {params[:sort].to_sym=>params[:order]} : {:postdate=>"desc"})

View File

@ -122,11 +122,11 @@
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="image_note" style="color:red; font-size:14px;">
<span style="font-weight: bolder;">※建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。</span>
<br />
※內文裡單一圖片大小為1MB以下。
<br />
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
<br />
※新聞及公告發佈後台請增加下列文字建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。
※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
</div>
<div class="textarea">
<%= f.fields_for :text_translations do |f| %>