fix for 0924

This commit is contained in:
Matthew K. Fu JuYuan 2012-09-24 18:30:19 +08:00
parent 5f63af4e77
commit 78a01f5d29
8 changed files with 8 additions and 7 deletions

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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: 編輯公告

View File

@ -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')}}

View File

@ -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}

View File

@ -112,7 +112,6 @@ class NewsBulletin
string :news_bulletin_category_id
time :postdate
end
# redis_search_index(:title_field => :s_title,

View File

@ -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