Add broadcasts to the dashboard

Shows current and previous broadcasts. Does not add a page for viewing
an individual broadcast.

Broadcasts are split into live and previous.

Draft broadcasts are excluded from the dashboard.
This commit is contained in:
Chris Hill-Scott
2020-07-09 15:48:56 +01:00
parent 78bda9d267
commit 6b822f9fde
7 changed files with 237 additions and 36 deletions

View File

@@ -1,5 +1,43 @@
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %}
{% extends "withnav_template.html" %}
{% macro broadcast_table(broadcasts, empty_message) %}
<div class='dashboard-table ajax-block-container'>
{% call(item, row_number) list_table(
broadcasts,
caption="Live broadcasts",
caption_visible=False,
empty_message=empty_message,
field_headings=[
'Template name',
'Status'
],
field_headings_visible=False
) %}
{% call row_heading() %}
<div class="file-list">
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="#">{{ item.template_name }}</a>
<span class="file-list-hint-large">
To {{ item.initial_area_names|formatted_list(before_each='', after_each='') }}
</span>
</div>
{% endcall %}
{% call field(align='right') %}
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0">
{% if item.status == 'broadcasting' %}
Live until {{ item.finishes_at|format_datetime_relative }}
{% elif item.status == 'cancelled' %}
Stopped {{ item.cancelled_at|format_datetime_relative }}
{% else %}
Finished {{ item.finishes_at|format_datetime_relative }}
{% endif %}
</p>
{% endcall %}
{% endcall %}
</div>
{% endmacro %}
{% block service_page_title %}
Dashboard
{% endblock %}
@@ -8,8 +46,12 @@
<h1 class="govuk-visually-hidden">Dashboard</h1>
<p class="govuk-body">
Broadcasts here
</p>
<h2 class="heading-medium govuk-!-margin-bottom-2">Live broadcasts</h2>
{{ broadcast_table(live_broadcasts, 'You do not have any live broadcasts at the moment') }}
<h2 class="heading-medium govuk-!-margin-bottom-2">Previous broadcasts</h2>
{{ broadcast_table(previous_broadcasts, 'You do not have any previous broadcasts') }}
{% endblock %}