From 78a01f5d2963a364ecd8c44c807993a8e75d2bd3 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 24 Sep 2012 18:30:19 +0800 Subject: [PATCH] fix for 0924 --- .../panel/announcement/front_end/bulletins_controller.rb | 5 ++--- vendor/built_in_modules/announcement/app/models/bulletin.rb | 2 ++ vendor/built_in_modules/announcement/config/locales/en.yml | 1 + .../built_in_modules/announcement/config/locales/zh_tw.yml | 2 +- .../panel/news/back_end/news_bulletins_controller.rb | 2 +- .../panel/news/front_end/news_bulletins_controller.rb | 1 - vendor/built_in_modules/news/app/models/news_bulletin.rb | 1 - vendor/built_in_modules/news/config/locales/en.yml | 1 + 8 files changed, 8 insertions(+), 7 deletions(-) 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 0e95657ae..f1b335c86 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 @@ -21,12 +21,11 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController @search = Bulletin.solr_search do fulltext params[:search_query] with(:frontend_search,true) - with(:available_lang, [I18n.locale.to_s]) - #order_by(:average_rating) + with(:available_lang, any_of([I18n.locale.to_s])) end search_result = @search.results.collect{|result| result.id}.desc(:postdate) - @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(15) + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).desc(:postdate).page( params[:page_main]).per(15) else date_now = Time.now if !params[:category_id].blank? && !params[:tag_id].blank? diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index b03b07f23..64b507c86 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -69,9 +69,11 @@ class Bulletin text :texts do text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text} end + string :available_lang , :multiple => true do VALID_LOCALES.collect{|t| enabled_for_lang(t.to_sym) ? t : nil}.delete_if{|t| t.nil?} end + # text :text do # a = (title_translations["zh_tw"] + title_translations["en"]) # a diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index a731178c2..5dc236b56 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -12,5 +12,6 @@ en: error: no_avilb_cate_for_posting: You need a category to submit your post,please contact admin new_bulletin_category: New announcememt category + search: Search for Announcement update_bulletin_success: Announcement was successfully updated update_bulletin_category_success: Announcement category was successfully updated diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index 3fe25d49d..4814586b4 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -4,7 +4,7 @@ zh_tw: announcement: 公告 approve_bulletin_fail: 公告審核失敗 approve_bulletin_success: 公告成功通過審核 - bulletins: Bulletins + bulletins: 公告訊息 create_bulletin_success: 公告已成功建立 create_bulletin_category_success: 公告類別已成功建立 editing_announcement: 編輯公告 diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb index e4cfaac9c..26e955d75 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb @@ -166,7 +166,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController respond_to do |format| if @news_bulletin.save expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner') - format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.create_news_bulletin_success')) } + format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) } format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin } format.js #format.json {render :json => {"success"=>"true","redirect_url"=>panel_news_back_end_news_bulletins_url,"notice" => t('news_bulletin.create_news_bulletin_success')}} diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index f6e7bba84..a939ae06a 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -23,7 +23,6 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController fulltext params[:search_query] with(:frontend_search,true) with(:available_lang).any_of([I18n.locale.to_s]) - #order_by(:postdate,:desc) end search_result = @search.results.collect{|result| result.id} diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb index 34a07aabf..d037960ab 100644 --- a/vendor/built_in_modules/news/app/models/news_bulletin.rb +++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb @@ -112,7 +112,6 @@ class NewsBulletin string :news_bulletin_category_id - time :postdate end # redis_search_index(:title_field => :s_title, diff --git a/vendor/built_in_modules/news/config/locales/en.yml b/vendor/built_in_modules/news/config/locales/en.yml index a1ae98a6d..8044ca0d2 100644 --- a/vendor/built_in_modules/news/config/locales/en.yml +++ b/vendor/built_in_modules/news/config/locales/en.yml @@ -11,6 +11,7 @@ en: hot: Hot news_bulletins: NewsBulletins new_news_category: New news category + search: Search for News update_news_bulletin_category_success: News category was successfully updated update_news_bulletin_success: News was successfully updated ut_prompt: Please select UT