mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-02 07:27:35 -04:00
Add the new alert button to previous alerts page
Feels like it should behave the same way as the current alerts page.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{% from 'components/ajax-block.html' import ajax_block %}
|
||||
{% from "components/button/macro.njk" import govukButton %}
|
||||
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
@@ -12,4 +13,15 @@
|
||||
|
||||
{% include('views/broadcast/partials/dashboard-table.html') %}
|
||||
|
||||
{% if current_user.has_permissions('send_messages') %}
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
{{ govukButton({
|
||||
"element": "a",
|
||||
"text": "New alert",
|
||||
"href": url_for('.new_broadcast', service_id=current_service.id),
|
||||
"classes": "govuk-button--secondary"
|
||||
}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -357,16 +357,20 @@ def test_broadcast_dashboard(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('endpoint', (
|
||||
'.broadcast_dashboard', '.broadcast_dashboard_previous',
|
||||
))
|
||||
def test_broadcast_dashboard_does_not_have_button_for_view_only_user(
|
||||
client_request,
|
||||
service_one,
|
||||
active_user_view_permissions,
|
||||
mock_get_broadcast_messages,
|
||||
endpoint,
|
||||
):
|
||||
service_one['permissions'] += ['broadcast']
|
||||
client_request.login(active_user_view_permissions)
|
||||
page = client_request.get(
|
||||
'.broadcast_dashboard',
|
||||
endpoint,
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
assert not page.select('a.govuk-button')
|
||||
@@ -420,6 +424,15 @@ def test_previous_broadcasts_page(
|
||||
'Example template This is a test Broadcast yesterday at 2:20am England Scotland',
|
||||
]
|
||||
|
||||
button = page.select_one(
|
||||
'.js-stick-at-bottom-when-scrolling a.govuk-button.govuk-button--secondary'
|
||||
)
|
||||
assert normalize_spaces(button.text) == 'New alert'
|
||||
assert button['href'] == url_for(
|
||||
'main.new_broadcast',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
|
||||
def test_new_broadcast_page(
|
||||
client_request,
|
||||
|
||||
Reference in New Issue
Block a user