-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2036] Added single-page tab script
- Loading branch information
1 parent
04dc704
commit 6e0f006
Showing
7 changed files
with
111 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,51 @@ | ||
// bindEvents() { | ||
// this.node.addEventListener('click', (e) => { | ||
// /** | ||
// * Remove focus from search in order to prevent native keyboard on mobile | ||
// */ | ||
// const blurFormInput = document.querySelectorAll( | ||
// '#login-form .input' | ||
// ) | ||
// blurFormInput.forEach((elem) => { | ||
// elem.blur() | ||
// }) | ||
// }) | ||
// } | ||
export class LoginFormFocus { | ||
static selector = '#login-form' | ||
|
||
constructor(node) { | ||
this.node = node | ||
this.usernameInput = node.querySelector('input[name="username"]') | ||
this.loginFormColumn = document.getElementById('column__login-form') | ||
this.emailToggleParent = document.getElementById('column__email-toggle') | ||
|
||
this.removeAutofocusAndFocus() | ||
this.hideLoginFormOnLoad() | ||
this.addEmailToggleListener() | ||
} | ||
|
||
removeAutofocusAndFocus() { | ||
if (this.usernameInput) { | ||
this.usernameInput.removeAttribute('autofocus') | ||
this.usernameInput.blur() | ||
} | ||
} | ||
|
||
hideLoginFormOnLoad() { | ||
if (this.loginFormColumn) { | ||
this.emailToggleParent.setAttribute('aria-expanded', 'false') | ||
this.loginFormColumn.classList.add('hide') | ||
} | ||
} | ||
|
||
addEmailToggleListener() { | ||
if (this.emailToggleParent) { | ||
const emailToggleParents = | ||
this.emailToggleParent.querySelectorAll('.link') | ||
emailToggleParents.forEach((link) => { | ||
link.addEventListener('click', (event) => { | ||
event.preventDefault() | ||
this.toggleLoginFormVisibility() | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
toggleLoginFormVisibility() { | ||
if (this.loginFormColumn) { | ||
this.loginFormColumn.classList.toggle('hide') | ||
this.usernameInput.focus() | ||
} | ||
} | ||
} | ||
|
||
const loginformFocuses = document.querySelectorAll(LoginFormFocus.selector) | ||
;[...loginformFocuses].forEach((element) => new LoginFormFocus(element)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 15 additions & 10 deletions
25
src/open_inwoner/templates/registration/password_reset_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
{% extends 'master.html' %} | ||
{% load i18n static form_tags %} | ||
{% load i18n static grid_tags form_tags %} | ||
|
||
{% block content %} | ||
<h1 class="h1">{% trans "Reset password" %}</h1> | ||
<p class="p">{% trans "Forgot your password? Enter your email address below. Then you will receive an email with instructions to set a new password." %}</p> | ||
<p class="p">{% trans "Please note: this only works if you do are not using DigiD to log in." %}</p> | ||
|
||
{% render_form id="password-reset-form" method="POST" form=form%} | ||
{% csrf_token %} | ||
{% input form.email %} | ||
{% form_actions primary_text=_("Reset password") primary_icon="arrow_forward" %} | ||
{% endrender_form %} | ||
|
||
{% render_grid %} | ||
{% render_column start=0 span=6 %} | ||
<h1 class="h1">{% trans "Reset password" %}</h1> | ||
<p class="p">{% trans "Forgot your password? Enter your email address below. Then you will receive an email with instructions to set a new password." %}</p> | ||
<p class="p">{% trans "Please note: this only works if you do are not using DigiD to log in." %}</p> | ||
|
||
{% render_form id="password-reset-form" method="POST" form=form %} | ||
{% csrf_token %} | ||
{% input form.email %} | ||
{% form_actions primary_text=_("Reset password") primary_icon="arrow_forward" %} | ||
{% endrender_form %} | ||
{% endrender_column %} | ||
{% endrender_grid %} | ||
|
||
{% endblock content %} |