Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Move conditional check to enjoyhint itself. Thus we can dynamically check for conditions and not only at the start of the tour.

Henriette Darge93a9829fd1bb
diff --git a/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts b/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts
index 44391fd1ace..402f9fb917d 100644
--- a/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts
+++ b/frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts
@@ -48,8 +48,6 @@ function initializeTour(storageValue:string, disabledElements?:string, projectSe
}
function startTour(steps:any[]) {
- steps = steps.filter((step) => step.condition ? step.condition() : true );
-
window.onboardingTourInstance.set(steps);
window.onboardingTourInstance.run();
}
diff --git a/frontend/src/app/core/setup/globals/onboarding/tours/boards_tour.ts b/frontend/src/app/core/setup/globals/onboarding/tours/boards_tour.ts
index c6dea2b40be..182570b68c9 100644
--- a/frontend/src/app/core/setup/globals/onboarding/tours/boards_tour.ts
+++ b/frontend/src/app/core/setup/globals/onboarding/tours/boards_tour.ts
@@ -31,7 +31,7 @@ export function boardTourSteps() {
showSkip: false,
nextButton: { text: I18n.t('js.onboarding.buttons.next') },
condition: () => {
- document.getElementsByClassName('board-list--add-button').length !== 0
+ return document.getElementsByClassName('board-list--add-button').length !== 0;
},
},
{
diff --git a/frontend/src/vendor/enjoyhint.js b/frontend/src/vendor/enjoyhint.js
index 5ddf356a386..f4860a2660c 100755
--- a/frontend/src/vendor/enjoyhint.js
+++ b/frontend/src/vendor/enjoyhint.js
@@ -101,6 +101,13 @@
var $enjoyhint = $('.enjoyhint');
var step_data = data[current_step];
+ // If the condition for the step is not fullfilled, skip it
+ if (step_data.condition && !step_data.condition()) {
+ current_step++;
+ stepAction();
+ return;
+ }
+
// Remove all classes
$enjoyhint.removeClass();
$enjoyhint.addClass("enjoyhint enjoyhint-step-" + (current_step + 1));