Browse Source

Autofocus the email field in the signup form, and submit on enter key

pull/307/head
Pēteris Caune 5 years ago
parent
commit
4625196ded
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 14 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +13
    -1
      static/js/signup.js

+ 1
- 0
CHANGELOG.md View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Add Go usage example - Add Go usage example
- Send monthly reports on 1st of every month, not randomly during the month - Send monthly reports on 1st of every month, not randomly during the month
- Signup form sets the "auto-login" cookie to avoid an extra click during first login - Signup form sets the "auto-login" cookie to avoid an extra click during first login
- Autofocus the email field in the signup form, and submit on enter key
### Bug Fixes ### Bug Fixes
- Prevent double-clicking the submit button in signup form - Prevent double-clicking the submit button in signup form


+ 13
- 1
static/js/signup.js View File

@ -1,6 +1,6 @@
$(function () { $(function () {
$("#signup-go").on("click", function() {
function submitForm() {
var base = document.getElementById("base-url").getAttribute("href").slice(0, -1); var base = document.getElementById("base-url").getAttribute("href").slice(0, -1);
var email = $("#signup-email").val(); var email = $("#signup-email").val();
var token = $('input[name=csrfmiddlewaretoken]').val(); var token = $('input[name=csrfmiddlewaretoken]').val();
@ -18,6 +18,18 @@ $(function () {
}); });
return false; return false;
}
$("#signup-go").on("click", submitForm);
$("#signup-email").keypress(function (e) {
if (e.which == 13) {
return submitForm();
}
}); });
$("#signup-modal").on('shown.bs.modal', function () {
$("#signup-email").focus()
})
}); });

Loading…
Cancel
Save