refactor: Remove inline javascript code from accounts_send_confirm.html.

This commit removes inline javascript code present in
accounts_send_confirm.html and moves it to signup.js. This page is
rendered when the "/accounts/send_confirm" endpoint is visited. An
empty div element is added in accounts_send_confirm.html with
unique data-page-id attribute to make it more easy to find in which
page we are, while working with the javascript code.
This commit is contained in:
Abhinav Singh 2019-03-16 11:44:49 +05:30 committed by Tim Abbott
parent 4b8f6b55be
commit 62d9241c03
2 changed files with 11 additions and 7 deletions

View File

@ -73,6 +73,14 @@ $(function () {
$("#timezone").val(moment.tz.guess()); $("#timezone").val(moment.tz.guess());
} }
// Code in this block will be executed when the /accounts/send_confirm
// endpoint is visited i.e. accounts_send_confirm.html is rendered.
if ($("[data-page-id='accounts-send-confirm']").length > 0) {
$("#resend_email_link").click(function () {
$('.resend_confirm').submit();
});
}
// Code in this block will be executed when the user visits // Code in this block will be executed when the user visits
// /accounts/password/reset i.e. reset.html is rendered. // /accounts/password/reset i.e. reset.html is rendered.
if ($("[data-page-id='reset-password-confirm']").length > 0) { if ($("[data-page-id='reset-password-confirm']").length > 0) {

View File

@ -2,6 +2,9 @@
{# Displayed after a user attempts to sign up. #} {# Displayed after a user attempts to sign up. #}
{% block portico_content %} {% block portico_content %}
<!-- The following empty tag has unique data-page-id so that this
page can be easily identified in it's respective JavaScript file -->
<div data-page-id="accounts-send-confirm"></div>
<div class="app portico-page"> <div class="app portico-page">
<div class="app-main portico-page-container center-block flex full-page account-creation new-style"> <div class="app-main portico-page-container center-block flex full-page account-creation new-style">
<div class="inline-block"> <div class="inline-block">
@ -36,11 +39,4 @@
{% block customhead %} {% block customhead %}
{{ super() }} {{ super() }}
<script>
$(function() {
$("#resend_email_link").click(function () {
$('.resend_confirm').submit();
});
});
</script>
{% endblock %} {% endblock %}