This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new e005cec Make "enter" do the natural thing when adding an email to an
account
e005cec is described below
commit e005cecb0119e92ee5d0be524a0881b740756489
Author: Dave Brondsema <[email protected]>
AuthorDate: Fri Jan 7 14:15:57 2022 -0500
Make "enter" do the natural thing when adding an email to an account
---
Allura/allura/templates/jinja_master/lib.html | 9 +++------
Allura/allura/templates/update_emails_form.html | 12 +++++++++++-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/Allura/allura/templates/jinja_master/lib.html
b/Allura/allura/templates/jinja_master/lib.html
index d69d8a6..7834684 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -139,18 +139,15 @@
<textarea id="{{name}}" name="{{name}}">{{value}}</textarea><br/>
{% endmacro %}
-{% macro text_field(name, label, value='') %}
+{% macro text_field(name, label, value='', type='text') %}
{% if label %}
<label for="{{name}}">{{label}}</label><br/>
{% endif %}
- <input type="text" id="{{name}}" name="{{name}}" class="text"
value="{{value}}"/><br/>
+ <input type="{{ type }}" id="{{name}}" name="{{name}}" class="text"
value="{{value}}"/><br/>
{% endmacro %}
{% macro password_field(name, label, value='') %}
- {% if label %}
- <label for="{{name}}">{{label}}</label><br/>
- {% endif %}
- <input type="password" id="{{name}}" name="{{name}}" class="text"
value="{{value}}"/><br/>
+ {{ text_field(name, label, value, type='password') }}
{% endmacro %}
{% macro hidden_field(name, value='') %}
diff --git a/Allura/allura/templates/update_emails_form.html
b/Allura/allura/templates/update_emails_form.html
index bc3cc33..803342f 100644
--- a/Allura/allura/templates/update_emails_form.html
+++ b/Allura/allura/templates/update_emails_form.html
@@ -57,8 +57,18 @@
</tr>
{% endfor %}
<tr>
- <td colspan="2">{{lib.text_field('new_addr.addr', '')}}</td>
+ <td colspan="2">{{lib.text_field('new_addr.addr', label='',
type='email')}}</td>
<td colspan="2">{{lib.submit_button('Claim New Address',
name='new_addr.claim')}}</td>
+ <script>
+ {# hitting Enter by default submits the first submit button which is
Delete. Override that #}
+ $('input[name="new_addr.addr"]').on('keypress', function(e) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ e.stopPropagation();
+ $('input[name="new_addr.claim"]').click();
+ }
+ });
+ </script>
</tr>
</table>
<div class="grid-22">