Files
notifications-admin/app/templates/views/templates/template.html
Chris Hill-Scott 9aa4a7267a Use <button> not <input>s for form submission
Both `<button type='submit'>Submit<button>` and
`<input type='submit' value='Submit'>` can be used to submit a form.

We have historically[1] used `<input>` because it’s better-supported by
IE6 in that:
- the `submit` attribute is mandatory on `<button>`, not on `<input>`
- the `innerHTML` of a button will be submitted to the server, not the
  value (as in other browsers)

Reasons to now use `<button>` instead:
- IE6/7 support is no longer a concern (especially with deprecation of
  TLS 1.0 on the way)
- Because an `<input>` element can’t have children, the pseudo-element
  hack[2] used to ensure the top edge of the button is clickable doesn’t
  work. We’re seeing this bug[3] affect real users in research.

1. We inhereted our buttons from Digital Marketplace, here is me making
   that change in their code:  8df7e2e79e (diff-b1420f7b7a25657d849edf90a70ef541)
2. 24e1906c0d (diff-ef0e4eb6f1e90b44b0c3fe39dce274a4R79)

3. https://github.com/alphagov/govuk_elements/issues/545
2018-02-01 13:53:45 +00:00

84 lines
3.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "withnav_template.html" %}
{% from "components/banner.html" import banner_wrapper %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% from "components/api-key.html" import api_key %}
{% block service_page_title %}
{{ template.name }}
{% endblock %}
{% block maincolumn_content %}
{% if show_redaction_message %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead='Are you sure you want to hide personalisation after sending?') %}
<ul class="list list-bullet">
<li>
You wont be able to see personalised content in Notify for this template
</li>
<li>
You cant undo this
</li>
</ul>
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="button" name="delete">Confirm</button>
</form>
{% endcall %}
</div>
{% elif template_delete_confirmation_message %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous', subhead=template_delete_confirmation_message[0]) %}
{% if template_delete_confirmation_message[1] %}
<p>
{{ template_delete_confirmation_message[1] }}
</p>
{% endif %}
<form method='post'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="button" name="delete">Confirm</button>
</form>
{% endcall %}
</div>
{% else %}
<h1 class="heading-large">{{ template.name }}</h1>
{% endif %}
<div class="grid-row">
{% with show_title=False, expanded=True %}
{% include 'views/templates/_template.html' %}
{% endwith %}
</div>
<div class="bottom-gutter-1-2">
{{ api_key(template.id, name="Template ID", thing='template ID') }}
</div>
<div class="bottom-gutter-1-2">
{% if template._template.updated_at %}
<h2 class="heading-small bottom-gutter-2-3 heading-inline">Last edited {{ template._template.updated_at|format_delta }}</h2>
&emsp;
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
&emsp;
<br/>
{% endif %}
{% if current_user.has_permissions('manage_templates', admin_override=True) %}
{% if not template._template.archived %}
<span class="page-footer-delete-link page-footer-delete-link-without-button bottom-gutter-2-3">
<a href="{{ url_for('.delete_service_template', service_id=current_service.id, template_id=template.id) }}">Delete this template</a>
</span>
&emsp;
{% endif %}
{% if not template._template.redact_personalisation %}
<span class="page-footer-delete-link page-footer-delete-link-without-button">
<a href="{{ url_for('.confirm_redact_template', service_id=current_service.id, template_id=template.id) }}">Hide personalisation after sending</a>
</span>
{% else %}
<p class="hint">Personalisation is hidden after sending</p>
{% endif %}
{% endif %}
</div>
{% endblock %}