Skip to content

Commit

Permalink
Testing the back button
Browse files Browse the repository at this point in the history
  • Loading branch information
saravahdatipour committed Feb 3, 2025
1 parent 9ea17f8 commit 295d7ea
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions webapp/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@ function setWindow(window, back) {
const backButton = $('#back-button');
backButton.off();

if (window === '2' && hasSubmitted) {
// Handle back button visibility and functionality based on window state
if (window === 'email-confirm' && hasSubmitted) {
backButton
.click(() => {
clearStatus();
setWindow('1');
setWindow('email-add');
return false;
})
.removeClass('button-hidden');
} else if (window === '3' && hasSubmitted) {
} else if (window === 'email-sent' && hasSubmitted) {
backButton
.click(() => {
clearStatus();
setWindow('2');
setWindow('email-confirm');
return false;
})
.removeClass('button-hidden');
Expand All @@ -60,7 +61,7 @@ function setWindow(window, back) {
const submitButtonText = MESSAGES['submit-' + window];
const submitButton = $('#submit-button');

if (window === '3') {
if (window === 'email-sent') {
submitButton.addClass('hidden');
} else {
submitButton
Expand All @@ -69,7 +70,11 @@ function setWindow(window, back) {
.off()
.click(() => {
hasSubmitted = true;
setWindow((parseInt(window) + 1).toString());
if (window === 'email-add') {
setWindow('email-confirm');
} else if (window === 'email-confirm') {
setWindow('email-sent');
}
return false;
});
}
Expand Down

0 comments on commit 295d7ea

Please sign in to comment.