From 66b37d17ee575b2a75de4d811282ce2a055942d7 Mon Sep 17 00:00:00 2001 From: nccu Date: Mon, 5 Jan 2015 15:21:44 +0800 Subject: [PATCH] fix search word & back page notice word --- app/controllers/announcements_controller.rb | 22 ++++++++++++++++++-- app/views/admin/announcements/_form.html.erb | 6 +++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 0d25171..4e25387 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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"}) diff --git a/app/views/admin/announcements/_form.html.erb b/app/views/admin/announcements/_form.html.erb index dc961fa..0574ba3 100644 --- a/app/views/admin/announcements/_form.html.erb +++ b/app/views/admin/announcements/_form.html.erb @@ -122,11 +122,11 @@
+ ※建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。 +
※內文裡單一圖片大小為1MB以下。
- ※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。 -
- ※新聞及公告發佈後台請增加下列文字:建議使用IE10、IE11、Chrome(最佳)、Firefox等瀏覽器。 + ※內文裡單一圖片尺寸的最大寬度600px(滿版),如圖片要縮小,請依比例調整。
<%= f.fields_for :text_translations do |f| %>