Projet

Général

Profil

0001-misc-switch-form-buttons-to-button-markup-22438.patch

Frédéric Péters, 22 mars 2018 09:45

Télécharger (20,4 ko)

Voir les différences:

Subject: [PATCH] misc: switch form buttons to <button> markup (#22438)

 .../auth2_auth/auth2_ssl/templates/auth/account_linking_ssl.html    | 2 +-
 .../auth2_auth/auth2_ssl/templates/auth/login_form_ssl.html         | 4 ++--
 src/authentic2/auth2_auth/auth2_ssl/templates/ssl/profile.html      | 4 ++--
 src/authentic2/manager/static/authentic2/manager/css/style.css      | 4 ++--
 src/authentic2/manager/static/authentic2/manager/js/manager.js      | 6 +++---
 src/authentic2/manager/templates/authentic2/manager/form.html       | 4 ++--
 .../manager/templates/authentic2/manager/user_detail.html           | 2 +-
 .../saml/templates/admin/saml/libertyprovider/add_from_url.html     | 2 +-
 src/authentic2/saml/templates/saml/post_form.html                   | 2 +-
 src/authentic2/templates/authentic2/accounts_delete.html            | 4 ++--
 src/authentic2/templates/authentic2/accounts_edit.html              | 6 +++---
 src/authentic2/templates/authentic2/change_email.html               | 4 ++--
 src/authentic2/templates/authentic2/homepage.html                   | 2 +-
 src/authentic2/templates/authentic2/login_password_form.html        | 4 ++--
 src/authentic2/templates/authentic2/logout_confirm.html             | 2 +-
 src/authentic2/templates/interaction/consent_attributes.html        | 6 +++---
 src/authentic2/templates/interaction/consent_federation.html        | 4 ++--
 src/authentic2/templates/registration/password_change_form.html     | 4 ++--
 src/authentic2/templates/registration/password_reset_confirm.html   | 2 +-
 src/authentic2/templates/registration/password_reset_form.html      | 2 +-
 .../templates/registration/registration_completion_form.html        | 2 +-
 src/authentic2/templates/registration/registration_form.html        | 2 +-
 src/authentic2_auth_saml/templates/authentic2_auth_saml/login.html  | 4 ++--
 .../templates/authentic2_idp_oidc/authorization.html                | 4 ++--
 tests/test_idp_saml2.py                                             | 3 +--
 25 files changed, 42 insertions(+), 43 deletions(-)
src/authentic2/auth2_auth/auth2_ssl/templates/auth/account_linking_ssl.html
35 35
    <input type="checkbox" name="do_creation" id="id_do_creation" />
36 36
  </p>
37 37

  
38
  <input type="submit" value="{% trans 'Log in' %}" class="submit" />
38
  <button class="submit-button">{% trans 'Log in' %}</button>
39 39
  <input type="hidden" name="next" value="{{ next_url }}" />
40 40
</form>
41 41
</div>
src/authentic2/auth2_auth/auth2_ssl/templates/auth/login_form_ssl.html
6 6
<form method="post" action="">
7 7
{% csrf_token %}
8 8
{{ form.as_p }}
9
<input type="submit" name="{{ submit_name }}" value="{% trans "Log in" %}"/>
9
<button class="submit-button" name="{{ submit_name }}">{% trans "Log in" %}</button>
10 10
{% if cancel %}
11
<input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
11
<button class="cancel-button" name="cancel">{% trans 'Cancel' %}"</button>
12 12
{% endif %}
13 13
</form>
14 14
</div>
src/authentic2/auth2_auth/auth2_ssl/templates/ssl/profile.html
18 18
            {% endfor %}
19 19
          </dl>
20 20
        </p>
21
        <input type="submit" class="submit-button a2-ssl-certificate-submit-button" value="{% trans "Delete" %}">
21
        <button class="submit-button a2-ssl-certificate-submit-button">{% trans "Delete" %}</button>
22 22
      </form>
23 23
    </p>
24 24
  {% endfor %}
......
27 27
    <form action="{% url "user_signin_ssl" %}" method="get">
28 28
      <label for="id_del_cert">{% trans "Add a certificate?" %}</label>
29 29
      <input type="hidden" name="next" value="{% url "account_management" %}#a2-ssl-certificate-profile" />
30
      <input type="submit" class="submit-button a2-ssl-certificate-submit-button" value="{% trans "Add" %}">
30
      <button class="submit-button a2-ssl-certificate-submit-button">{% trans "Add" %}</button>
31 31
    </form>
32 32
  </p>
33 33
</div>
src/authentic2/manager/static/authentic2/manager/css/style.css
86 86
  width: 30%;
87 87
}
88 88

  
89
.other_actions input[type=submit] {
89
.other_actions button {
90 90
  display: block;
91 91
  margin: 5px;
92 92
  width: 100%;
......
112 112
  max-width: 50%;
113 113
}
114 114

  
115
.warning-box input[type=submit] {
115
.warning-box button {
116 116
  float: right;
117 117
}
118 118

  
src/authentic2/manager/static/authentic2/manager/js/manager.js
139 139
          return false;
140 140
        });
141 141
        /* confirmation on submit buttons */
142
        $(document).on('click', 'input[type=submit]', function (e) {
142
        $(document).on('click', 'button', function (e) {
143 143
          if ($(e.target).data('confirm')) {
144 144
            if (! confirm($(e.target).data('confirm'))) {
145 145
              e.preventDefault();
......
153 153
              window.location.href = $(e.target).data('url');
154 154
            }
155 155
          }
156
        })
156
        });
157 157
        $(document).on('change', '#id_generate_password', function (e) {
158 158
            if ($(e.target).is(':checked')) {
159 159
                $('#id_send_mail').prop('disabled', true);
......
168 168
                $('#id_password2').prop('disabled', false);
169 169
            }
170 170
        });
171
        $(document).on('click.manager', 'table tr[data-url][rel=popup], button[rel=popup]', displayPopup);
171
        $(document).on('click.manager', 'table tr[data-url][rel=popup]', displayPopup);
172 172
        $(document).on('click.manager', 'table tr[data-url]:not([rel=popup])', function (e) {
173 173
                window.location.href = $(this).data('url');
174 174
        });
src/authentic2/manager/templates/authentic2/manager/form.html
74 74
        {% if other_actions %}
75 75
            <strong>{% trans "Actions" %}</strong>
76 76
            {% for action in other_actions %}
77
              <input type="submit" name="{{ action.name }}" value="{{ action.title }}"
77
              <button name="{{ action.name }}"
78 78
                {% if action.confirm %}data-confirm="{{ action.confirm }}"{% endif %}
79 79
                {% if action.url_name %}data-url="{% url action.url_name pk=object.pk %}"{% endif %}
80 80
                {% if action.url %}data-url="{{ action.url }}"{% endif %}
81 81
                {% if action.popup %}rel="popup"{% endif %}
82
              />
82
                >{{ action.title }}</button>
83 83
            {% endfor %}
84 84
        {% endif %}
85 85
      {% endblock %}
src/authentic2/manager/templates/authentic2/manager/user_detail.html
31 31
{% block afterform %}
32 32
  {% if object.passwordreset_set.exists %}
33 33
    <div class="warning-box">{% trans "User must change its password on next access to authentic" %}
34
      <input type="submit" name="delete_password_reset" value="{% trans "Cancel this constraint" %}"/>
34
      <button name="delete_password_reset">{% trans "Cancel this constraint" %}</button>
35 35
    </div>
36 36
  {% endif %}
37 37
{% endblock %}
src/authentic2/saml/templates/admin/saml/libertyprovider/add_from_url.html
34 34
<table>
35 35
    {{ form.as_table }}
36 36
</table>
37
<input type="submit"/>
37
<button>{% trans "Submit" %}</button>
38 38

  
39 39

  
40 40
</div>
src/authentic2/saml/templates/saml/post_form.html
17 17
   {% endif %}
18 18
   <noscript>
19 19
     <div class="buttons-bar">
20
      <input type="submit" name="sendButton" value="{% trans 'Send' %}" />
20
      <button name="sendButton">{% trans 'Send' %}</button>
21 21
     </div>
22 22
  </noscript>
23 23
  </form>
src/authentic2/templates/authentic2/accounts_delete.html
17 17
  {% csrf_token %}
18 18
  <p>{% trans "Delete my account and all my personal datas ?" %}</p>
19 19
  {{ form.as_p }}
20
  <input type="submit" name="submit" value="{% trans "Delete" %}"/>
21
  <input type="submit" name="cancel" value="{% trans "Cancel" %}"/>
20
  <button class="delete-button" name="submit">{% trans "Delete" %}</button>
21
  <button class="cancel-button" name="cancel">{% trans "Cancel" %}</button>
22 22
</form>
23 23
{% endblock %}
src/authentic2/templates/authentic2/accounts_edit.html
26 26
    {% csrf_token %}
27 27
    {{ form.as_p }}
28 28
    {% if form.instance and form.instance.id %}
29
      <input type="submit" value="{% trans "Submit" %}"/>
30
      <input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
29
      <button class="submit-button">{% trans "Submit" %}</button>
30
      <button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
31 31
    {% else %}
32
      <input type="submit" value="{% trans "Create" %}"/>
32
      <button class="submit-button">{% trans "Create" %}</button>
33 33
    {% endif %}
34 34
  </form>
35 35
{% endblock %}
src/authentic2/templates/authentic2/change_email.html
17 17
  <form method="post">
18 18
    {% csrf_token %}
19 19
    {{ form.as_p }}
20
    <input type="submit" value="{% trans "Validate" %}"/>
21
    <input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
20
    <button class="submit-button">{% trans "Validate" %}</button>
21
    <button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
22 22
  </form>
23 23
{% endblock %}
src/authentic2/templates/authentic2/homepage.html
31 31
          {% endfor %}
32 32
          {% endif %}
33 33
          <input type="hidden" name="next" value="/"/>
34
          <input type="submit" class="submit-link" value="{{ action.0 }}">
34
          <button class="submit-link">{{ action.0 }}</button>
35 35
        </form>
36 36
        {% endif %}
37 37
      {% endfor %}
src/authentic2/templates/authentic2/login_password_form.html
3 3
<form method="post" action="">
4 4
{% csrf_token %}
5 5
{{ form.as_p }}
6
<input type="submit" name="{{ submit_name }}" value="{% trans "Log in" %}"/>
6
<button class="submit-button" name="{{ submit_name }}">{% trans "Log in" %}</button>
7 7
{% if cancel %}
8
<input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
8
<button class="cancel-button" name="cancel">{% trans 'Cancel' %}</button>
9 9
{% endif %}
10 10
</form>
11 11
</div>
src/authentic2/templates/authentic2/logout_confirm.html
16 16
    <form method="post">
17 17
      {% csrf_token %}
18 18
      <input type="hidden" name="next" value="{{ next_url }}">
19
      <input type="submit" name="submit" value="{% trans "Continue" %}">
19
      <button name="submit">{% trans "Continue" %}</button>
20 20
      <a href="{{ next_url }}">{% trans "Cancel" %}</a>
21 21
    </form>
22 22
  </p>
src/authentic2/templates/interaction/consent_attributes.html
28 28
<input type="hidden" name="next" value="{{ next }}" />
29 29
<input type="hidden" name="nonce" value="{{ nonce }}" />
30 30
{% if allow_selection %}
31
<input type="submit" name="accept" value="{% trans 'Send selected' %}"/>
31
<button name="accept">{% trans 'Send selected' %}</button>
32 32
{% else %}
33
<input type="submit" name="accept" value="{% trans 'Send all' %}"/>
33
<button name="accept">{% trans 'Send all' %}</button>
34 34
{% endif %}
35
<input type="submit" name="refuse" value="{% trans 'Refuse all' %}"/>
35
<button name="refuse">{% trans 'Refuse all' %}</button>
36 36
</form>
37 37
</div>
38 38

  
src/authentic2/templates/interaction/consent_federation.html
20 20
{% csrf_token %}
21 21
<input type="hidden" name="next" value="{{ next }}" />
22 22
<input type="hidden" name="nonce" value="{{ nonce }}" />
23
<input type="submit" name="accept" value="{% trans 'Accept' %}"/>
24
<input type="submit" name="refuse" value="{% trans 'Refuse' %}"/>
23
<button name="accept">{% trans 'Accept' %}</button>
24
<button name="refuse">{% trans 'Refuse' %}</button>
25 25
</form>
26 26
</div>
27 27

  
src/authentic2/templates/registration/password_change_form.html
18 18
    {% endblocktrans %}</p>
19 19
    {% csrf_token %}
20 20
    {{ form.as_p }}
21
    <input type="submit" value="{% trans 'Submit' %}" />
22
    <input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
21
    <button class="submit-button">{% trans 'Submit' %}</button>
22
    <button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button>
23 23
  </form>
24 24
{% endblock %}
src/authentic2/templates/registration/password_reset_confirm.html
13 13
  {% csrf_token %}
14 14
  {{ form.as_p }}
15 15

  
16
  <input type="submit" value="{% trans 'Submit' %}" />
16
  <button class="submit-button">{% trans 'Submit' %}</button>
17 17
</form>
18 18

  
19 19
{% else %}
src/authentic2/templates/registration/password_reset_form.html
13 13
  {% csrf_token %}
14 14
  {{ form.as_p }}
15 15

  
16
  <input type="submit" value="{% trans 'Submit' %}" />
16
  <button class="submit-button">{% trans 'Submit' %}</button>
17 17
</form>
18 18
{% endblock %}
src/authentic2/templates/registration/registration_completion_form.html
28 28
      <form method="post">
29 29
        {% csrf_token %}
30 30
        {{ form.as_p }}
31
        <input type="submit" value="{% trans 'Submit' %}" />
31
        <button class="submit-button">{% trans 'Submit' %}</button>
32 32
      </form>
33 33
{% endblock %}
src/authentic2/templates/registration/registration_form.html
18 18
<form method="post">
19 19
  {% csrf_token %}
20 20
  {{ form.as_p }}
21
  <input type="submit" value="{% trans 'Submit' %}" />
21
  <button class="submit-button">{% trans 'Submit' %}</button>
22 22
</form>
23 23

  
24 24
{% for id, block in frontends.items %}
src/authentic2_auth_saml/templates/authentic2_auth_saml/login.html
1 1
{% load i18n %}<form method="post">
2
    <input type="submit" name="{{ submit_name }}" value="{% trans "Login" %}"/>
2
    <button class="submit-button" name="{{ submit_name }}">{% trans "Login" %}</button>
3 3
    {% if cancel %}
4
        <input type="submit" name="cancel" value="{% trans 'Cancel' %}"/>
4
        <button class="cancel-button" name="cancel">{% trans 'Cancel' %}</button>
5 5
    {% endif %}
6 6
</form>
7 7

  
src/authentic2_idp_oidc/templates/authentic2_idp_oidc/authorization.html
16 16
      </ul>
17 17
    {% endif %}
18 18
    {% csrf_token %}
19
    <input type="submit" name="accept" value="{% trans "Accept" %}">
20
    <input type="submit" name="refuse" value="{% trans "Refuse" %}">
19
    <button name="accept">{% trans "Accept" %}</button>
20
    <button name="refuse">{% trans "Refuse" %}</button>
21 21
  </form>
22 22
{% endblock %}
tests/test_idp_saml2.py
258 258
        response = client.get(url)
259 259
        self.assertEqual(response.status_code, 200)
260 260
        self.assertEqual(response['Content-Type'].split(';')[0], 'text/html')
261
        self.assertInHTML(u'<input type="submit" name="cancel" '
262
                          'value="%s"/>' % _('Cancel'), response.content,
261
        self.assertInHTML(u'<button class="cancel-button" name="cancel">%s</button>' % _('Cancel'), response.content,
263 262
                          count=1)
264 263
        if cancel:
265 264
            response = client.post(url, {
266
-