mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Always go back to previous page from notification
When looking at a notification you can either be coming from the page of all notifications, or from a job. Currently the back link always takes you to the page of all notifications. This commit makes it a bit more sophisticated so if you’ve come from looking at a job, you go back to the job.
This commit is contained in:
@@ -101,6 +101,21 @@ def view_notification(service_id, notification_id):
|
||||
show_cancel_button = notification['notification_type'] == 'letter' and \
|
||||
letter_can_be_cancelled(notification['status'], notification_created)
|
||||
|
||||
if request.args.get('help') == '0':
|
||||
back_link = None
|
||||
elif request.args.get('from_job'):
|
||||
back_link = url_for(
|
||||
'main.view_job',
|
||||
service_id=current_service.id,
|
||||
job_id=request.args.get('from_job'),
|
||||
)
|
||||
else:
|
||||
back_link = url_for(
|
||||
'main.view_notifications',
|
||||
service_id=current_service.id,
|
||||
message_type=template.template_type,
|
||||
)
|
||||
|
||||
return render_template(
|
||||
'views/notifications/notification.html',
|
||||
finished=(notification['status'] in (DELIVERED_STATUSES + FAILURE_STATUSES)),
|
||||
@@ -133,6 +148,7 @@ def view_notification(service_id, notification_id):
|
||||
sent_with_test_key=(
|
||||
notification.get('key_type') == KEY_TYPE_TEST
|
||||
),
|
||||
back_link=back_link,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user