mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-17 04:59:37 -04:00
Show pending broadcasts on dashboard
When we have an approval flow, `pending-approval` will be the state a broadcast is in between being a draft and broadcasting. This means it is the earliest stage at which a broadcast can appear on the dashboard, so this commit adds a new section at the top of the dashboard to display these broadcasts (since the dashboard is in a reverse chronological order). Rather than displaying the scheduled time, the extra information shown is the person who drafted the broadcast, since I reckon you’ll be coming to this page because they’ve asked you to approve their broadcast.
This commit is contained in:
@@ -13,7 +13,7 @@ from app.utils import service_has_permission, user_has_permissions
|
||||
def broadcast_dashboard(service_id):
|
||||
return render_template(
|
||||
'views/broadcast/dashboard.html',
|
||||
partials=get_broadcast_dashboard_partials(current_service.id)
|
||||
partials=get_broadcast_dashboard_partials(current_service.id),
|
||||
)
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ def broadcast_dashboard_updates(service_id):
|
||||
def get_broadcast_dashboard_partials(service_id):
|
||||
broadcast_messages = BroadcastMessages(service_id)
|
||||
return dict(
|
||||
pending_approval_broadcasts=render_template(
|
||||
'views/broadcast/partials/dashboard-table.html',
|
||||
broadcasts=broadcast_messages.with_status('pending-approval'),
|
||||
empty_message='You do not have any broadcasts waiting for approval',
|
||||
),
|
||||
live_broadcasts=render_template(
|
||||
'views/broadcast/partials/dashboard-table.html',
|
||||
broadcasts=broadcast_messages.with_status('broadcasting'),
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
|
||||
<h1 class="govuk-visually-hidden">Dashboard</h1>
|
||||
|
||||
<h2 class="heading-medium govuk-!-margin-bottom-2">Waiting for approval</h2>
|
||||
|
||||
{{ ajax_block(
|
||||
partials,
|
||||
url_for('.broadcast_dashboard_updates', service_id=current_service.id),
|
||||
'pending_approval_broadcasts'
|
||||
) }}
|
||||
|
||||
<h2 class="heading-medium govuk-!-margin-bottom-2">Live broadcasts</h2>
|
||||
|
||||
{{ ajax_block(
|
||||
|
||||
@@ -21,7 +21,11 @@
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{% if item.status == 'broadcasting' %}
|
||||
{% if item.status == 'pending-approval' %}
|
||||
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0">
|
||||
Prepared by {{ item.created_by.name }}
|
||||
</p>
|
||||
{% elif item.status == 'broadcasting' %}
|
||||
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0">
|
||||
Live until {{ item.finishes_at|format_datetime_relative }}
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user