From ed63042480113227cc3d1f4b51da253210c063e0 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 13 Sep 2019 11:56:51 -0700 Subject: [PATCH] templates: Replace focusing scripts with autofocus attribute. Signed-off-by: Anders Kaseorg --- static/js/portico/signup.js | 20 -- templates/zerver/accounts_home.html | 2 +- templates/zerver/create_realm.html | 6 +- templates/zerver/login.html | 284 ++++++++++++++-------------- templates/zerver/reset.html | 6 +- templates/zerver/reset_confirm.html | 5 +- 6 files changed, 141 insertions(+), 182 deletions(-) diff --git a/static/js/portico/signup.js b/static/js/portico/signup.js index 860b6a4865..63f3015db4 100644 --- a/static/js/portico/signup.js +++ b/static/js/portico/signup.js @@ -81,29 +81,9 @@ $(function () { }); } - // Code in this block will be executed when the user visits - // /accounts/password/reset i.e. reset.html is rendered. - if ($("[data-page-id='reset-password-confirm']").length > 0) { - common.autofocus('#id_new_password1'); - } - - // Code in this block will be executed when the user visits - // /accounts/password/reset i.e. reset.html is rendered. - if ($("[data-page-id='reset-password']").length > 0) { - common.autofocus('#id_email'); - } - - // Code in this block will be executed when the user visits /new - // i.e. create_realm.html is rendered. - if ($("[data-page-id='create-realm']").length > 0) { - common.autofocus('#email'); - } - // Code in this block will be executed when the user visits /register // i.e. accounts_home.html is rendered. if ($("[data-page-id='accounts-home']").length > 0) { - common.autofocus('#email'); - if (window.location.hash.substring(0, 1) === "#") { document.email_form.action += window.location.hash; } diff --git a/templates/zerver/accounts_home.html b/templates/zerver/accounts_home.html index c5ac3b4981..444392bd77 100644 --- a/templates/zerver/accounts_home.html +++ b/templates/zerver/accounts_home.html @@ -55,7 +55,7 @@ page can be easily identified in it's respective JavaScript file --> {{ csrf_input }}
- + {% if form.email.errors %} diff --git a/templates/zerver/create_realm.html b/templates/zerver/create_realm.html index ba3ebf012a..d425cbd1e5 100644 --- a/templates/zerver/create_realm.html +++ b/templates/zerver/create_realm.html @@ -4,10 +4,6 @@ {# This is where we pitch the app and solicit signups. #} {% block portico_content %} - - -
@@ -22,7 +18,7 @@ page can be easily identified in it's respective JavaScript file -->
+ id="email" name="email" autofocus required />
diff --git a/templates/zerver/login.html b/templates/zerver/login.html index 830b0e472a..3b511ba043 100644 --- a/templates/zerver/login.html +++ b/templates/zerver/login.html @@ -8,162 +8,152 @@ {% block portico_content %} + +
+