diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 0939152..769674b 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -8,13 +8,13 @@ class AnnouncementsController < ApplicationController if params[:keywords] !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_top=>"desc",: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 + announcements_count = ",共有" + announcements.count.to_s + "筆資料" keyword = "搜尋標題有關 ' " + params[:keywords] + " '" elsif params[:unit] !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_top=>"desc",: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 + announcements_count = ",共有" + announcements.count.to_s + "筆資料" keyword = "列出由:" + params[:unit] + "發佈的資料" elsif params[:tag] @@ -26,7 +26,7 @@ class AnnouncementsController < ApplicationController !params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:is_top=>"desc",: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 + announcements_count = ",共有" + announcements.count.to_s + "筆資料" keywords = params[:category].split("-") keywords.delete(keywords.last)