Update text for status.(top: 重要)
This commit is contained in:
parent
d194f962dd
commit
13b9b850ce
|
@ -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)
|
||||
|
|
|
@ -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 << "<span class='label label-success'>#{top_text}</span> " if self.is_top
|
||||
status << "<span class='label label-important'>#{hot_text}</span> " if self.is_hot
|
||||
status << "<span class='label'>#{hidden_text}</span>"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
|
||||
|
|
|
@ -137,3 +137,7 @@ en:
|
|||
show_page: Show pagination
|
||||
URL: URL
|
||||
copy: Copy
|
||||
status:
|
||||
top: Important
|
||||
hot: Hot
|
||||
hidden: Hidden
|
|
@ -139,4 +139,8 @@ zh_tw:
|
|||
url_generate: 網址生成
|
||||
show_page: 顯示頁碼
|
||||
URL: 網址
|
||||
copy: 複製
|
||||
copy: 複製
|
||||
status:
|
||||
top: 重要
|
||||
hot: 熱門
|
||||
hidden: 隱藏
|
Loading…
Reference in New Issue