diff --git a/app/models/announcement_setting.rb b/app/models/announcement_setting.rb
index 8078b11..e4a7810 100644
--- a/app/models/announcement_setting.rb
+++ b/app/models/announcement_setting.rb
@@ -8,6 +8,9 @@ class AnnouncementSetting
field :email_to, type: Array, :default => ["admins","managers","approvers"]
field :is_display_edit_only, type: Boolean, :default => false
field :only_manager_can_edit_status, type: Boolean, :default => false
+ field :top_text , type: String , localize: true
+ field :hot_text , type: String , localize: true
+ field :hidden_text , type: String , localize: true
has_many :anns_status_settings, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :anns_status_settings, :allow_destroy => true
def self.check_limit_for_user(user_id, b_id = nil)
diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb
index 8e36977..85b37e1 100644
--- a/app/models/bulletin.rb
+++ b/app/models/bulletin.rb
@@ -189,4 +189,34 @@ class Bulletin
role_ids = user.member_profile.roles.collect{|v| v.id.to_s} rescue ['visitor']
self.open_comment && (self.comment_end_time.blank? || self.comment_end_time > Time.now) && (self.comment_role.any?{|v| role_ids.include?(v)} || self.comment_role.include?('visitor') || (self.comment_role.include?('all_member') && role_ids[0] != 'visitor'))
end
+ def statuses
+ statuses = []
+ statuses << top_text if is_top?
+ statuses << hot_text if is_hot?
+ statuses << hidden_text if is_hidden?
+ statuses
+ end
+ def statuses_with_classname
+ statuses = []
+ statuses << {"name" => top_text, "classname" => "top"} if is_top?
+ statuses << {"name" => hot_text, "classname" => "hot"} if is_hot?
+ statuses << {"name" => hidden_text, "classname" => "hidden"} if is_hidden?
+ statuses
+ end
+ def status_for_table
+ status = ""
+ status << "#{top_text} " if self.is_top
+ status << "#{hot_text} " if self.is_hot
+ status << "#{hidden_text}"if self.is_hidden
+ status.html_safe
+ end
+ def top_text
+ I18n.t("announcement.status.top")
+ end
+ def hot_text
+ I18n.t("announcement.status.hot")
+ end
+ def hidden_text
+ I18n.t("announcement.status.hidden")
+ end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 11bd2ca..8144bc7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -137,3 +137,7 @@ en:
show_page: Show pagination
URL: URL
copy: Copy
+ status:
+ top: Important
+ hot: Hot
+ hidden: Hidden
\ No newline at end of file
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index 700004e..f07f209 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -139,4 +139,8 @@ zh_tw:
url_generate: 網址生成
show_page: 顯示頁碼
URL: 網址
- copy: 複製
\ No newline at end of file
+ copy: 複製
+ status:
+ top: 重要
+ hot: 熱門
+ hidden: 隱藏
\ No newline at end of file