From 22d25b7a1c1f20c1013b751d7518369a8128d983 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Fri, 25 Feb 2022 16:12:31 +0000 Subject: [PATCH] Use `govukButton` to display 'Preview this alert' button There are no changes to appearance of the 'Preview this alert' button or what it does, but this stops a CSRF token appearing in the query string when you click the button. We don't need a CSRF token - it's a simple GET request which doesn't change any data. Before, we had a form with `method="get"` but because we were using a `page_footer` a CSRF token was being added. We can replace both the `
` element and `page_footer` with a `govukButton`. This means that we make a GET request with no CSRF token without changing the appearance of the button. --- app/templates/views/broadcast/preview-areas.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/templates/views/broadcast/preview-areas.html b/app/templates/views/broadcast/preview-areas.html index 99b8ae1fd..8e4238c6c 100644 --- a/app/templates/views/broadcast/preview-areas.html +++ b/app/templates/views/broadcast/preview-areas.html @@ -63,9 +63,12 @@ {% if broadcast_message.areas %} {{ map(broadcast_message) }} - - {{ page_footer('Preview this alert') }} -
+ {{ govukButton({ + "element": "a", + "text": "Preview this alert", + "href": url_for('.preview_broadcast_message', service_id=current_service.id, broadcast_message_id=broadcast_message.id), + "classes": "govuk-button" + }) }} {% endif %} {% endblock %}