code that can not run on matt's air
This commit is contained in:
parent
e5fa86c24a
commit
029c84328d
|
@ -21,9 +21,10 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
@search = Bulletin.solr_search do
|
@search = Bulletin.solr_search do
|
||||||
fulltext params[:search_query]
|
fulltext params[:search_query]
|
||||||
with(:frontend_search,true)
|
with(:frontend_search,true)
|
||||||
|
with(:available_lang, [I18n.locale.to_s])
|
||||||
#order_by(:average_rating)
|
#order_by(:average_rating)
|
||||||
end
|
end
|
||||||
search_result = @search.results.collect{|result| result.id}
|
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).page( params[:page_main]).per(15)
|
||||||
else
|
else
|
||||||
|
|
|
@ -69,6 +69,9 @@ class Bulletin
|
||||||
text :texts do
|
text :texts do
|
||||||
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
||||||
end
|
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
|
# text :text do
|
||||||
# a = (title_translations["zh_tw"] + title_translations["en"])
|
# a = (title_translations["zh_tw"] + title_translations["en"])
|
||||||
# a
|
# a
|
||||||
|
|
|
@ -19,13 +19,15 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||||
if !params[:search_query].blank?
|
if !params[:search_query].blank?
|
||||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
||||||
# search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
# search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||||
|
binding.pry
|
||||||
@search = NewsBulletin.solr_search do
|
@search = NewsBulletin.solr_search do
|
||||||
fulltext params[:search_query]
|
fulltext params[:search_query]
|
||||||
with(:frontend_search,true)
|
with(:frontend_search,true)
|
||||||
|
with(:available_lang, [I18n.locale.to_s])
|
||||||
#order_by(:average_rating)
|
#order_by(:average_rating)
|
||||||
end
|
end
|
||||||
search_result = @search.results.collect{|result| result.id}
|
binding.pry
|
||||||
|
search_result = @search.results.collect{|result| result.id}.desc(:postdate)
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||||
else
|
else
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
|
|
|
@ -102,6 +102,10 @@ class NewsBulletin
|
||||||
end
|
end
|
||||||
integer :view_count
|
integer :view_count
|
||||||
|
|
||||||
|
string :available_lang , :multiple => true do
|
||||||
|
VALID_LOCALES.collect{|t| enabled_for_lang(t.to_sym) ? t : nil}.delete_if{|t| t.nil?}
|
||||||
|
end
|
||||||
|
|
||||||
boolean :frontend_search do
|
boolean :frontend_search do
|
||||||
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue