Merge branch 'i18n_var' of github.com:Rulingcom/NCCU into i18n_var
Conflicts: app/controllers/pages_controller.rb app/models/item.rb app/models/site.rb config/environments/development.rb vendor/built_in_modules/announcement/app/models/bulletin.rb
This commit is contained in:
commit
23854e7adc
|
@ -46,7 +46,7 @@ class Bulletin
|
||||||
mount_uploader :image, ImageUploader
|
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_links, :cascade_callbacks => true
|
||||||
# embeds_many :bulletin_files, :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_links
|
||||||
after_save :save_bulletin_files
|
after_save :save_bulletin_files
|
||||||
|
|
||||||
redis_search_index(:title_field => :s_title,
|
redis_search_index(:title_field => :s_title,
|
||||||
:alias_field =>:s_title_en ,
|
:alias_field =>:s_title_en ,
|
||||||
:score_field => :view_count,
|
:score_field => :view_count,
|
||||||
:condition_fields => [:is_checked,:is_hidden,:bulletin_category_id],
|
:condition_fields => [:is_checked,:is_hidden,:bulletin_category_id],
|
||||||
:ext_fields => [])
|
:ext_fields => [])
|
||||||
# def gen_title_for_search
|
# def gen_title_for_search
|
||||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def s_title
|
def s_title
|
||||||
self.title.zh_tw
|
self.title.zh_tw
|
||||||
end
|
end
|
||||||
|
|
||||||
def s_title_en
|
def s_title_en
|
||||||
self.title.en
|
self.title.en
|
||||||
end
|
end
|
||||||
|
|
||||||
# def s_text_en
|
# def s_text_en
|
||||||
# Nokogiri::HTML(self.text.en).text
|
# Nokogiri::HTML(self.text.en).text
|
||||||
# end
|
# end
|
||||||
# def s_text_zh_tw
|
# def s_text_zh_tw
|
||||||
# Nokogiri::HTML(self.text.zh_tw).text
|
# Nokogiri::HTML(self.text.zh_tw).text
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# scope :currently_available, lambda { |category, limit|
|
# scope :currently_available, lambda { |category, limit|
|
||||||
# # limit ||= 5
|
# # limit ||= 5
|
||||||
# # {
|
# # {
|
||||||
# # debugger
|
# # debugger
|
||||||
# # a=1
|
# # a=1
|
||||||
# :where => {:bulletin_category_id => bulletin_category_id, :disable => false}#,
|
# :where => {:bulletin_category_id => bulletin_category_id, :disable => false}#,
|
||||||
# # :limit => limit
|
# # :limit => limit
|
||||||
# # }
|
# # }
|
||||||
# }
|
# }
|
||||||
def de_pending
|
def de_pending
|
||||||
self.is_pending = false
|
self.is_pending = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish_month
|
def publish_month
|
||||||
published_at.strftime("%B %Y")
|
published_at.strftime("%B %Y")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search( search = nil, category_id = nil )
|
def self.search( search = nil, category_id = nil )
|
||||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||||
|
|
Loading…
Reference in New Issue