Merge pull request #3681 from alphagov/adjust-hierarchy-broadcast-page

Re-order hierarchy of information when viewing a single broadcast
This commit is contained in:
Chris Hill-Scott
2020-10-20 12:06:57 +01:00
committed by GitHub
5 changed files with 71 additions and 56 deletions

View File

@@ -252,6 +252,16 @@ details .arrow {
//box-shadow: inset 0 0 0 2px $red, inset 0 0 0 5px $white; //box-shadow: inset 0 0 0 2px $red, inset 0 0 0 5px $white;
} }
&--left {
&:before {
float: left;
margin-left: 0;
margin-right: 10px;
}
}
} }
input:-webkit-autofill::first-line { input:-webkit-autofill::first-line {

View File

@@ -32,15 +32,11 @@
</p> </p>
{% elif item.status == 'broadcasting' %} {% elif item.status == 'broadcasting' %}
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0 live-broadcast"> <p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0 live-broadcast">
Live until {{ item.finishes_at|format_datetime_relative }} Live since {{ item.starts_at|format_datetime_relative }}
</p>
{% elif item.status == 'cancelled' %}
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0 govuk-hint">
Stopped {{ item.cancelled_at|format_datetime_relative }}
</p> </p>
{% else %} {% else %}
<p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0 govuk-hint"> <p class="govuk-body govuk-!-margin-top-6 govuk-!-margin-bottom-0 govuk-hint">
Finished {{ item.finishes_at|format_datetime_relative }} Broadcast {{ item.starts_at|format_datetime_relative }}
</p> </p>
{% endif %} {% endif %}
{% endcall %} {% endcall %}

View File

@@ -14,19 +14,17 @@
{{ page_header("Preview", back_link=url_for('.preview_broadcast_areas', service_id=current_service.id, broadcast_message_id=broadcast_message.id)) }} {{ page_header("Preview", back_link=url_for('.preview_broadcast_areas', service_id=current_service.id, broadcast_message_id=broadcast_message.id)) }}
{% for area in broadcast_message.areas %} {{ broadcast_message.template|string }}
{% if loop.first %}
<ul class="area-list"> <div class="govuk-!-margin-bottom-3">
{% endif %} <ul class="area-list">
{% for area in broadcast_message.areas %}
<li class="area-list-item area-list-item--unremoveable"> <li class="area-list-item area-list-item--unremoveable">
{{ area.name }} {{ area.name }}
</li> </li>
{% if loop.last %} {% endfor %}
</ul> </ul>
{% endif %} </div>
{% endfor %}
{{ broadcast_message.template|string }}
{% call form_wrapper() %} {% call form_wrapper() %}
{{ page_footer('Submit for approval') }} {{ page_footer('Submit for approval') }}

View File

@@ -99,36 +99,27 @@
{% else %} {% else %}
{{ page_header(broadcast_message.template_name) }} {{ page_header(broadcast_message.template_name) }}
<p class="govuk-body govuk-!-margin-bottom-3"> {% if broadcast_message.status == 'broadcasting' %}
Created by {{ broadcast_message.created_by.name }} and approved by <p class="govuk-body govuk-!-margin-bottom-2 live-broadcast live-broadcast--left">
{{ broadcast_message.approved_by.name }}. Live since {{ broadcast_message.starts_at|format_datetime_relative }}&ensp;
</p>
<p class="govuk-body govuk-!-margin-bottom-3">
Started broadcasting
{{ broadcast_message.starts_at|format_datetime_human }}.
</p>
<p class="govuk-body">
{% if broadcast_message.status == 'pending-approval' %}
Will broadcast until {{ broadcast_message.finishes_at|format_datetime_relative }}.
{% elif broadcast_message.status == 'broadcasting' %}
Live until {{ broadcast_message.finishes_at|format_datetime_relative }}&ensp;
{%- if not hide_stop_link %} {%- if not hide_stop_link %}
<a href="{{ url_for('.cancel_broadcast_message', service_id=current_service.id, broadcast_message_id=broadcast_message.id) }}" class="destructive-link destructive-link--no-visited-state">Stop broadcast early</a> <a href="{{ url_for('.cancel_broadcast_message', service_id=current_service.id, broadcast_message_id=broadcast_message.id) }}" class="destructive-link destructive-link--no-visited-state">Stop broadcasting</a>
{% endif %} {% endif %}
{% elif broadcast_message.status == 'cancelled' %} </p>
Stopped by {{ broadcast_message.cancelled_by.name }} {% else %}
{{ broadcast_message.cancelled_at|format_datetime_human }}. <p class="govuk-body govuk-!-margin-bottom-4">
{% else %} Broadcast
Finished broadcasting {{ broadcast_message.finishes_at|format_datetime_human }}. {{ broadcast_message.starts_at|format_datetime_human }}.
{% endif %} </p>
</p> {% endif %}
{% endif %} {% endif %}
{{ broadcast_message.template|string }}
{% for area in broadcast_message.areas %} {% for area in broadcast_message.areas %}
{% if loop.first %} {% if loop.first %}
<ul class="area-list govuk-!-margin-bottom-4"> <ul class="area-list">
{% endif %} {% endif %}
<li class="area-list-item area-list-item--unremoveable"> <li class="area-list-item area-list-item--unremoveable">
{{ area.name }} {{ area.name }}
@@ -145,6 +136,26 @@
}) }} }) }}
</div> </div>
{{ broadcast_message.template|string }} {% if broadcast_message.status != 'pending-approval' %}
<p class="govuk-body govuk-!-margin-bottom-3">
Prepared by {{ broadcast_message.created_by.name }} and approved by
{{ broadcast_message.approved_by.name }}.
</p>
{% endif %}
{% if broadcast_message.status == 'broadcasting' %}
<p class="govuk-body">
Broadcasting stops {{ broadcast_message.finishes_at|format_datetime_human }}.
</p>
{% elif broadcast_message.status == 'cancelled' %}
<p class="govuk-body">
Stopped by {{ broadcast_message.cancelled_by.name }}
{{ broadcast_message.cancelled_at|format_datetime_human }}.
</p>
{% elif broadcast_message.status == 'completed' %}
<p class="govuk-body">
Finished broadcasting {{ broadcast_message.finishes_at|format_datetime_human }}.
</p>
{% endif %}
{% endblock %} {% endblock %}

View File

@@ -302,7 +302,7 @@ def test_broadcast_dashboard(
assert [ assert [
normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr') normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr')
] == [ ] == [
'Example template This is a test England Scotland Live until tomorrow at 2:20am', 'Example template This is a test England Scotland Live since today at 2:20am',
] ]
assert normalize_spaces(page.select('main h2')[1].text) == ( assert normalize_spaces(page.select('main h2')[1].text) == (
@@ -338,7 +338,7 @@ def test_broadcast_dashboard_json(
} }
assert 'Prepared by Test User' in json_response['pending_approval_broadcasts'] assert 'Prepared by Test User' in json_response['pending_approval_broadcasts']
assert 'Live until tomorrow at 2:20am' in json_response['live_broadcasts'] assert 'Live since today at 2:20am' in json_response['live_broadcasts']
@freeze_time('2020-02-20 02:20') @freeze_time('2020-02-20 02:20')
@@ -361,8 +361,8 @@ def test_previous_broadcasts_page(
assert [ assert [
normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr') normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr')
] == [ ] == [
'Example template This is a test England Scotland Stopped 10 February at 2:20am', 'Example template This is a test England Scotland Broadcast yesterday at 2:20am',
'Example template This is a test England Scotland Finished yesterday at 8:20pm', 'Example template This is a test England Scotland Broadcast yesterday at 2:20pm',
] ]
@@ -1037,24 +1037,24 @@ def test_start_broadcasting(
'status': 'broadcasting', 'status': 'broadcasting',
'finishes_at': '2020-02-23T23:23:23.000000', 'finishes_at': '2020-02-23T23:23:23.000000',
}, [ }, [
'Created by Alice and approved by Bob.', 'Live since 20 February at 8:20pm Stop broadcasting',
'Started broadcasting on 20 February at 8:20pm.', 'Prepared by Alice and approved by Bob.',
'Live until tomorrow at 11:23pm Stop broadcast early', 'Broadcasting stops tomorrow at 11:23pm.'
]), ]),
({ ({
'status': 'broadcasting', 'status': 'broadcasting',
'finishes_at': '2020-02-22T22:20:20.000000', # 2 mins before now() 'finishes_at': '2020-02-22T22:20:20.000000', # 2 mins before now()
}, [ }, [
'Created by Alice and approved by Bob.', 'Broadcast on 20 February at 8:20pm.',
'Started broadcasting on 20 February at 8:20pm.', 'Prepared by Alice and approved by Bob.',
'Finished broadcasting today at 10:20pm.', 'Finished broadcasting today at 10:20pm.'
]), ]),
({ ({
'status': 'finished', 'status': 'completed',
'finishes_at': '2020-02-21T21:21:21.000000', 'finishes_at': '2020-02-21T21:21:21.000000',
}, [ }, [
'Created by Alice and approved by Bob.', 'Broadcast on 20 February at 8:20pm.',
'Started broadcasting on 20 February at 8:20pm.', 'Prepared by Alice and approved by Bob.',
'Finished broadcasting yesterday at 9:21pm.', 'Finished broadcasting yesterday at 9:21pm.',
]), ]),
({ ({
@@ -1062,8 +1062,8 @@ def test_start_broadcasting(
'cancelled_by_id': sample_uuid, 'cancelled_by_id': sample_uuid,
'cancelled_at': '2020-02-21T21:21:21.000000', 'cancelled_at': '2020-02-21T21:21:21.000000',
}, [ }, [
'Created by Alice and approved by Bob.', 'Broadcast on 20 February at 8:20pm.',
'Started broadcasting on 20 February at 8:20pm.', 'Prepared by Alice and approved by Bob.',
'Stopped by Carol yesterday at 9:21pm.', 'Stopped by Carol yesterday at 9:21pm.',
]), ]),
)) ))