diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index a0f3a43a..98e1242e 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -46,7 +46,7 @@ class Bulletin mount_uploader :image, ImageUploader -# belongs_to :unit_list_for_anc + # belongs_to :unit_list_for_anc # embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true @@ -64,46 +64,46 @@ class Bulletin after_save :save_bulletin_links after_save :save_bulletin_files - redis_search_index(:title_field => :s_title, + redis_search_index(:title_field => :s_title, :alias_field =>:s_title_en , :score_field => :view_count, :condition_fields => [:is_checked,:is_hidden,:bulletin_category_id], :ext_fields => []) -# def gen_title_for_search -# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ') -# end + # def gen_title_for_search + # # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ') + # end - def s_title + def s_title self.title.zh_tw - end + end - def s_title_en + def s_title_en self.title.en - end + end - # def s_text_en - # Nokogiri::HTML(self.text.en).text - # end - # def s_text_zh_tw - # Nokogiri::HTML(self.text.zh_tw).text - # end + # def s_text_en + # Nokogiri::HTML(self.text.en).text + # end + # def s_text_zh_tw + # Nokogiri::HTML(self.text.zh_tw).text + # end -# scope :currently_available, lambda { |category, limit| -# # limit ||= 5 -# # { -# # debugger -# # a=1 -# :where => {:bulletin_category_id => bulletin_category_id, :disable => false}#, -# # :limit => limit -# # } -# } -def de_pending - self.is_pending = false -end + # scope :currently_available, lambda { |category, limit| + # # limit ||= 5 + # # { + # # debugger + # # a=1 + # :where => {:bulletin_category_id => bulletin_category_id, :disable => false}#, + # # :limit => limit + # # } + # } + def de_pending + self.is_pending = false + end -def publish_month - published_at.strftime("%B %Y") -end + def publish_month + published_at.strftime("%B %Y") + end def self.search( search = nil, category_id = nil ) if category_id.to_s.size > 0 and search.to_s.size > 0