mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-24 15:54:00 +08:00
Fix report notification breadcrumbs [SCI-9856]
This commit is contained in:
parent
b1492ff0ce
commit
ce3618003b
4 changed files with 23 additions and 0 deletions
|
@ -28,6 +28,10 @@ module Reports
|
|||
message: I18n.t('projects.reports.index.generation.completed_notification_message',
|
||||
report_link: "<a href='#{report_path}'>#{escape_input(report.name)}</a>",
|
||||
team_name: escape_input(report.team.name)),
|
||||
subject_id: report_id,
|
||||
subject_class: 'Report',
|
||||
subject_name: report.name,
|
||||
report_type: 'docx',
|
||||
user: @user
|
||||
}
|
||||
)
|
||||
|
|
|
@ -168,6 +168,10 @@ module Reports
|
|||
message: I18n.t('projects.reports.index.generation.completed_notification_message',
|
||||
report_link: "<a href='#{report_path}'>#{escape_input(@report.name)}</a>",
|
||||
team_name: escape_input(@report.team.name)),
|
||||
subject_id: @report.id,
|
||||
subject_class: 'Report',
|
||||
subject_name: @report.name,
|
||||
report_type: 'pdf',
|
||||
user: @user
|
||||
}
|
||||
)
|
||||
|
|
|
@ -12,4 +12,12 @@ class DeliveryNotification < BaseNotification
|
|||
def title
|
||||
params[:title]
|
||||
end
|
||||
|
||||
def subject
|
||||
return unless params[:subject_id] && params[:subject_class]
|
||||
|
||||
params[:subject_class].constantize.find(params[:subject_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
NonExistantRecord.new(params[:subject_name])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,6 +65,13 @@ class NotificationSerializer < ActiveModel::Serializer
|
|||
when RepositoryRow
|
||||
parent = subject.team
|
||||
url = repository_path(subject.repository)
|
||||
when Report
|
||||
parent = subject.team
|
||||
url = reports_path(
|
||||
preview_report_id: subject.id,
|
||||
preview_type: object.params[:report_type],
|
||||
team_id: subject.team.id
|
||||
)
|
||||
when LabelTemplate
|
||||
parent = subject.team
|
||||
url = label_template_path(subject)
|
||||
|
|
Loading…
Reference in a new issue