dev_forum
jingquan huang 5 years ago
commit 3cb88e8951

@ -98,7 +98,7 @@ module TidingDecorator
end end
def apply_add_schools_content def apply_add_schools_content
name = container.name name = ApplyAddSchool.find_by(id: container_id)&.name
if tiding_type == 'Apply' if tiding_type == 'Apply'
I18n.t(locale_format(tiding_type)) % name I18n.t(locale_format(tiding_type)) % name
elsif status == 2 elsif status == 2
@ -201,7 +201,7 @@ module TidingDecorator
when 'Issue' then when 'Issue' then
I18n.t(locale_format(parent_container_type)) % parent_container.subject I18n.t(locale_format(parent_container_type)) % parent_container.subject
when 'Journal' then when 'Journal' then
message = object.notes.present? ? '' + message_content_helper(parent_container.notes) : '' message = parent_container&.notes.present? ? '' + message_content_helper(parent_container.notes) : ''
I18n.t(locale_format(parent_container_type)) % message I18n.t(locale_format(parent_container_type)) % message
end end
end end
@ -331,13 +331,17 @@ module TidingDecorator
end end
def challenge_work_score_content def challenge_work_score_content
I18n.t(locale_format) % container&.comment
end
def student_works_scores_appeal_content
work = StudentWork.find_by(id: parent_container_id) work = StudentWork.find_by(id: parent_container_id)
return if work.blank? name = work&.homework_common&.name
if parent_container_type == 'StudentWork' if parent_container_type == 'StudentWork'
I18n.t(locale_format(parent_container_type, tiding_type)) % work.homework_common.try(:name) I18n.t(locale_format(parent_container_type, tiding_type)) % name
elsif parent_container_type == 'UserAppealResult' || parent_container_type == 'AppealResult' else
I18n.t(locale_format(parent_container_type, status)) % work.homework_common.try(:name) I18n.t(locale_format(parent_container_type, status)) % name
end end
end end
@ -349,7 +353,7 @@ module TidingDecorator
if tiding_type == 'System' if tiding_type == 'System'
I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title) I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title)
else else
I18n.t(locale_format) % container.try(:title) I18n.t(locale_format(tiding_type)) % container.try(:title)
end end
end end

@ -0,0 +1,4 @@
class Journal < ApplicationRecord
belongs_to :user
belongs_to :issue, foreign_key: :journalized_id
end

@ -6,4 +6,16 @@ class Tiding < ApplicationRecord
belongs_to :belong_container, polymorphic: true, optional: true belongs_to :belong_container, polymorphic: true, optional: true
has_many :attachments, as: :container has_many :attachments, as: :container
def identifier
value = nil
if Object.const_defined?(container_type)
value = container.try(:identifier)
end
if value.blank? && belong_container_type && Object.const_defined?(belong_container_type)
value = belong_container.try(:identifier)
end
value
end
end end

@ -1,6 +1,6 @@
json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, :parent_container_id, :parent_container_type json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, :parent_container_id, :parent_container_type
json.content tiding.content json.content tiding.content
json.identifier tiding.try(:container).try(:identifier) rescue nil json.identifier tiding.identifier
json.time tiding.how_long_time json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time) json.new_tiding tiding.unread?(@onclick_time)

@ -87,7 +87,7 @@
</noscript> </noscript>
<!--用于markdown转html --> <!--用于markdown转html -->
<div id="md_div" style="display: none;"></div> <div id="md_div" style="display: none;"></div>
<div id="root" class="page -layout-v -fit widthunit" style="min-width: 1535px;"> <div id="root" class="page -layout-v -fit widthunit">
<!--<div class="d2-home">--> <!--<div class="d2-home">-->
<!--<div class="d2-home__main">--> <!--<div class="d2-home__main">-->
<!--&lt;!&ndash;<img class="d2-home__loading"&ndash;&gt;--> <!--&lt;!&ndash;<img class="d2-home__loading"&ndash;&gt;-->

Loading…
Cancel
Save