Ensure correct selected nav item on broadcast page

Once a broadcast has been submitted for approval it either lives on the
‘Current alerts’ or ‘Previous alerts’ page, depending on where it is
in its lifecycle.

Therefore when clicking into a broadcast from one of those pages the
same navigation item should remain selected.

Because we select the navigation items based on the request endpoint,
this means we need an endpoint for each navigation page, even if the
content of the pages will be the same in both cases.

This commit adds the two new end points, removes the old, single
endpoint and updates links to point to the new endpoint.
This commit is contained in:
Chris Hill-Scott
2020-10-15 13:15:22 +01:00
parent 92b735f6e4
commit b54d49196b
5 changed files with 61 additions and 36 deletions

View File

@@ -5,8 +5,8 @@
<ul>
{% if current_user.has_permissions() %}
{% if current_service.has_permission('broadcast') %}
<li><a class="govuk-link govuk-link--no-visited-state{{ main_navigation.is_selected('dashboard') }}" href="{{ url_for('.broadcast_dashboard', service_id=current_service.id) }}">Current alerts</a></li>
<li><a class="govuk-link govuk-link--no-visited-state{{ main_navigation.is_selected('previous_broadcasts') }}" href="{{ url_for('.broadcast_dashboard_previous', service_id=current_service.id) }}">Previous alerts</a></li>
<li><a class="govuk-link govuk-link--no-visited-state{{ main_navigation.is_selected('current-broadcasts') }}" href="{{ url_for('.broadcast_dashboard', service_id=current_service.id) }}">Current alerts</a></li>
<li><a class="govuk-link govuk-link--no-visited-state{{ main_navigation.is_selected('previous-broadcasts') }}" href="{{ url_for('.broadcast_dashboard_previous', service_id=current_service.id) }}">Previous alerts</a></li>
{% elif current_user.has_permissions('view_activity') %}
<li><a class="govuk-link govuk-link--no-visited-state{{ main_navigation.is_selected('dashboard') }}" href="{{ url_for('.service_dashboard', service_id=current_service.id) }}">Dashboard</a></li>
{% endif %}