Skip to content

Commit

Permalink
HDX-9420 display alert if user tries to go back to page b
Browse files Browse the repository at this point in the history
  • Loading branch information
ccataalin committed Feb 12, 2024
1 parent 03962c2 commit 5715e42
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
window.history.pushState({page: 2}, null, null);

window.onpopstate = function (event) {
if (event) {
var r = confirm('Hold on! Your data has already been saved. Are you sure you want to go back to the previous page and reload the signup process?');
if (r === true) {
history.back();
} else {
window.history.pushState({page: 2}, '', '');
}
}
}
6 changes: 6 additions & 0 deletions ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/webassets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ hdx-onboarding-scripts:
- onboarding/came-from-input.js
- onboarding/confirm-page-leave.js

prevent-back-button:
<<: *common-js
output: ckanext-hdx_theme/%(version)s_prevent-back-button.js
contents:
- onboarding/prevent-back-button.js

search-scripts:
<<: *common-js
output: ckanext-hdx_theme/%(version)s_search-scripts.js
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{% extends "onboarding/base.html" %}

{% block scripts %}
{{ super() }}
{% asset 'hdx_theme/prevent-back-button' %}
{% endblock %}

{% set CONST = h.HDX_CONST('UI_CONSTANTS')['ONBOARDING']['VERIFY_EMAIL'] %}

{% block subtitle %}{{ _('User info') }}{% endblock %}
Expand Down

0 comments on commit 5715e42

Please sign in to comment.