misc: switch form buttons to <button> markup (#22438)

This commit is contained in:
Frédéric Péters 2018-03-21 17:51:12 +01:00
parent a2c89aded8
commit 85545e5d35
25 changed files with 49 additions and 43 deletions

View File

@ -35,7 +35,7 @@
<input type="checkbox" name="do_creation" id="id_do_creation" />
</p>
<input type="submit" value="{% trans 'Log in' %}" class="submit" />
<button class="submit-button">{% trans 'Log in' %}</button>
<input type="hidden" name="next" value="{{ next_url }}" />
</form>
</div>

View File

@ -6,9 +6,9 @@
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="{{ submit_name }}" value="{% trans "Log in" %}"/>
<button class="submit-button" name="{{ submit_name }}">{% trans "Log in" %}</button>
{% if cancel %}
<input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
<button class="cancel-button" name="cancel">{% trans 'Cancel' %}"</button>
{% endif %}
</form>
</div>

View File

@ -18,7 +18,7 @@
{% endfor %}
</dl>
</p>
<input type="submit" class="submit-button a2-ssl-certificate-submit-button" value="{% trans "Delete" %}">
<button class="submit-button a2-ssl-certificate-submit-button">{% trans "Delete" %}</button>
</form>
</p>
{% endfor %}
@ -27,7 +27,7 @@
<form action="{% url "user_signin_ssl" %}" method="get">
<label for="id_del_cert">{% trans "Add a certificate?" %}</label>
<input type="hidden" name="next" value="{% url "account_management" %}#a2-ssl-certificate-profile" />
<input type="submit" class="submit-button a2-ssl-certificate-submit-button" value="{% trans "Add" %}">
<button class="submit-button a2-ssl-certificate-submit-button">{% trans "Add" %}</button>
</form>
</p>
</div>

View File

@ -102,13 +102,18 @@ table.users tbody tr td:nth-child(2):hover {
width: 30%;
}
.other_actions input[type=submit] {
.other_actions button {
display: block;
margin: 5px;
width: 100%;
white-space: normal;
}
.other_actions .user-roles button {
display: inline-block;
width: auto;
}
li#roles a { background-image: url(icon-personnes.png); }
li#roles a:hover { background-image: url(icon-personnes-hover.png); }
@ -128,7 +133,7 @@ li#users a:hover { background-image: url(icon-user-hover.png); }
max-width: 50%;
}
.warning-box input[type=submit] {
.warning-box button {
float: right;
}

View File

@ -139,7 +139,7 @@
return false;
});
/* confirmation on submit buttons */
$(document).on('click', 'input[type=submit]', function (e) {
$(document).on('click', 'button', function (e) {
if ($(e.target).data('confirm')) {
if (! confirm($(e.target).data('confirm'))) {
e.preventDefault();
@ -153,7 +153,7 @@
window.location.href = $(e.target).data('url');
}
}
})
});
$(document).on('change', '#id_generate_password', function (e) {
if ($(e.target).is(':checked')) {
$('#id_send_mail').prop('disabled', true);
@ -168,7 +168,7 @@
$('#id_password2').prop('disabled', false);
}
});
$(document).on('click.manager', 'table tr[data-url][rel=popup], button[rel=popup]', displayPopup);
$(document).on('click.manager', 'table tr[data-url][rel=popup]', displayPopup);
$(document).on('click.manager', 'table tr[data-url]:not([rel=popup])', function (e) {
window.location.href = $(this).data('url');
});

View File

@ -74,12 +74,12 @@
{% if other_actions %}
<strong>{% trans "Actions" %}</strong>
{% for action in other_actions %}
<input type="submit" name="{{ action.name }}" value="{{ action.title }}"
<button name="{{ action.name }}"
{% if action.confirm %}data-confirm="{{ action.confirm }}"{% endif %}
{% if action.url_name %}data-url="{% url action.url_name pk=object.pk %}"{% endif %}
{% if action.url %}data-url="{{ action.url }}"{% endif %}
{% if action.popup %}rel="popup"{% endif %}
/>
>{{ action.title }}</button>
{% endfor %}
{% endif %}
{% endblock %}

View File

@ -31,7 +31,7 @@
{% block afterform %}
{% if object.passwordreset_set.exists %}
<div class="warning-box">{% trans "User must change its password on next access to authentic" %}
<input type="submit" name="delete_password_reset" value="{% trans "Cancel this constraint" %}"/>
<button name="delete_password_reset">{% trans "Cancel this constraint" %}</button>
</div>
{% endif %}
{% endblock %}
@ -66,6 +66,7 @@
{{ block.super }}
{% if roles or can_change_roles %}
<div class="user-roles">
<strong>{% trans "Roles" %}</strong>
<ul>
{% for role in object.roles_and_parents %}
@ -78,6 +79,7 @@
{% if can_change_roles %}
<button onclick="window.location.href = '{% url "a2-manager-user-roles" pk=object.pk %}?search-ou={% firstof object.ou.pk default_ou.pk %}'; return false">{% trans "Modify" %}</button>
{% endif %}
</div>
{% endif %}

View File

@ -34,7 +34,7 @@
<table>
{{ form.as_table }}
</table>
<input type="submit"/>
<button>{% trans "Submit" %}</button>
</div>

View File

@ -17,7 +17,7 @@
{% endif %}
<noscript>
<div class="buttons-bar">
<input type="submit" name="sendButton" value="{% trans 'Send' %}" />
<button name="sendButton">{% trans 'Send' %}</button>
</div>
</noscript>
</form>

View File

@ -17,7 +17,7 @@
{% csrf_token %}
<p>{% trans "Delete my account and all my personal datas ?" %}</p>
{{ form.as_p }}
<input type="submit" name="submit" value="{% trans "Delete" %}"/>
<input type="submit" name="cancel" value="{% trans "Cancel" %}"/>
<button class="delete-button" name="submit">{% trans "Delete" %}</button>
<button class="cancel-button" name="cancel">{% trans "Cancel" %}</button>
</form>
{% endblock %}

View File

@ -26,10 +26,10 @@
{% csrf_token %}
{{ form.as_p }}
{% if form.instance and form.instance.id %}
<input type="submit" value="{% trans "Submit" %}"/>
<input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
<button class="submit-button">{% trans "Submit" %}</button>
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
{% else %}
<input type="submit" value="{% trans "Create" %}"/>
<button class="submit-button">{% trans "Create" %}</button>
{% endif %}
</form>
{% endblock %}

View File

@ -17,7 +17,7 @@
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans "Validate" %}"/>
<input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
<button class="submit-button">{% trans "Validate" %}</button>
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
</form>
{% endblock %}

View File

@ -31,7 +31,7 @@
{% endfor %}
{% endif %}
<input type="hidden" name="next" value="/"/>
<input type="submit" class="submit-link" value="{{ action.0 }}">
<button class="submit-link">{{ action.0 }}</button>
</form>
{% endif %}
{% endfor %}

View File

@ -3,9 +3,9 @@
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="{{ submit_name }}" value="{% trans "Log in" %}"/>
<button class="submit-button" name="{{ submit_name }}">{% trans "Log in" %}</button>
{% if cancel %}
<input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
<button class="cancel-button" name="cancel">{% trans 'Cancel' %}</button>
{% endif %}
</form>
</div>

View File

@ -16,7 +16,7 @@
<form method="post">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next_url }}">
<input type="submit" name="submit" value="{% trans "Continue" %}">
<button name="submit">{% trans "Continue" %}</button>
<a href="{{ next_url }}">{% trans "Cancel" %}</a>
</form>
</p>

View File

@ -28,11 +28,11 @@
<input type="hidden" name="next" value="{{ next }}" />
<input type="hidden" name="nonce" value="{{ nonce }}" />
{% if allow_selection %}
<input type="submit" name="accept" value="{% trans 'Send selected' %}"/>
<button name="accept">{% trans 'Send selected' %}</button>
{% else %}
<input type="submit" name="accept" value="{% trans 'Send all' %}"/>
<button name="accept">{% trans 'Send all' %}</button>
{% endif %}
<input type="submit" name="refuse" value="{% trans 'Refuse all' %}"/>
<button name="refuse">{% trans 'Refuse all' %}</button>
</form>
</div>

View File

@ -20,8 +20,8 @@
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
<input type="hidden" name="nonce" value="{{ nonce }}" />
<input type="submit" name="accept" value="{% trans 'Accept' %}"/>
<input type="submit" name="refuse" value="{% trans 'Refuse' %}"/>
<button name="accept">{% trans 'Accept' %}</button>
<button name="refuse">{% trans 'Refuse' %}</button>
</form>
</div>

View File

@ -18,7 +18,7 @@
{% endblocktrans %}</p>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
<input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
<button class="submit-button">{% trans 'Submit' %}</button>
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
</form>
{% endblock %}

View File

@ -13,7 +13,7 @@
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
<button class="submit-button">{% trans 'Submit' %}</button>
</form>
{% else %}

View File

@ -13,6 +13,6 @@
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
<button class="submit-button">{% trans 'Submit' %}</button>
</form>
{% endblock %}

View File

@ -28,6 +28,6 @@
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
<button class="submit-button">{% trans 'Submit' %}</button>
</form>
{% endblock %}

View File

@ -18,7 +18,7 @@
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
<button class="submit-button">{% trans 'Submit' %}</button>
</form>
{% for id, block in frontends.items %}

View File

@ -1,7 +1,7 @@
{% load i18n %}<form method="post">
<input type="submit" name="{{ submit_name }}" value="{% trans "Login" %}"/>
<button class="submit-button" name="{{ submit_name }}">{% trans "Login" %}</button>
{% if cancel %}
<input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
<button class="cancel-button" name="cancel">{% trans 'Cancel' %}</button>
{% endif %}
</form>

View File

@ -16,7 +16,7 @@
</ul>
{% endif %}
{% csrf_token %}
<input type="submit" name="accept" value="{% trans "Accept" %}">
<input type="submit" name="refuse" value="{% trans "Refuse" %}">
<button name="accept">{% trans "Accept" %}</button>
<button name="refuse">{% trans "Refuse" %}</button>
</form>
{% endblock %}

View File

@ -258,8 +258,7 @@ class SamlSSOTestCase(SamlBaseTestCase):
response = client.get(url)
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'].split(';')[0], 'text/html')
self.assertInHTML(u'<input type="submit" name="cancel" '
'value="%s"/>' % _('Cancel'), response.content,
self.assertInHTML(u'<button class="cancel-button" name="cancel">%s</button>' % _('Cancel'), response.content,
count=1)
if cancel:
response = client.post(url, {