From 397b44439080a02a3bb3ae16d5f8c1970a21c301 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 24 Jul 2012 20:58:34 +0800 Subject: [PATCH] fix for bugs --- lib/tasks/data_migration.rake | 8 ++++++-- .../panel/announcement/front_end/bulletins_controller.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tasks/data_migration.rake b/lib/tasks/data_migration.rake index 98b3dd3e..8d0c3db8 100644 --- a/lib/tasks/data_migration.rake +++ b/lib/tasks/data_migration.rake @@ -21,12 +21,16 @@ namespace :data_migration do task :add_search_widget_to_news_and_announcement => :environment do app = ModuleApp.first({:conditions=>{:title => 'news'}}) - app.widgets << "bulletins_search_block" if app.widgets.include?("bulletins_search_block") + app.widgets << "news_bulletins_search_block" if !app.widgets.include?("news_bulletins_search_block") app.save! app = ModuleApp.first({:conditions=>{:title => 'Announcement'}}) - app.widgets << "news_bulletins_search_block" if app.widgets.include?("news_bulletins_search_block") + app.widgets << "bulletins_search_block" if !app.widgets.include?("bulletins_search_block") app.save! p "==DO NOT FORGET TO RUN: rake redis_search:index" end + task :add_search_func => :environment do + ModuleApp.create!(:key=>'search',:title => 'search',:enable_frontend=> true,:app_pages=>["full_search","optional_search"]) + end + end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index ba8b949c..1449ec91 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -14,7 +14,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? search = Redis::Search.query("Bulletin", params[:search_query], :conditions =>search_cond) search_result = search.collect{|t| t["id"]} - @news_bulletins = Bulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10) + @bulletins = Bulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10) else date_now = Time.now if !params[:category_id].blank?