refactor: Remove inline javascript code from create_realm.html.

This commit removes inline javascript code present in create_realm.html
and moves it to signup.js. The create_realm.html page is rendered when
the user visits "/new". An empty div element is added in
create_realm.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-02 14:15:20 +05:30 committed by Tim Abbott
parent 2a14fcf3e9
commit 65d9d017c3
2 changed files with 9 additions and 5 deletions

View File

@ -73,6 +73,12 @@ $(function () {
$("#timezone").val(moment.tz.guess());
}
// 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) {

View File

@ -4,12 +4,10 @@
{# This is where we pitch the app and solicit signups. #}
{% block portico_content %}
<script>
$(function () {
common.autofocus('#email');
});
</script>
<!-- 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="create-realm"></div>
<div class="app register-page">
<div class="app-main register-page-container new-style flex full-page center">