Skip to content

Commit

Permalink
[BUGFIX] Load all tours on start already
Browse files Browse the repository at this point in the history
Tour may not start and throw an error instead:
    "startTour: SomeTourName tour not found"

This is because the tour is not loaded/initialized yet.

with this fix all available tours are always loaded.

* Pro: Tours working again.
* Con: Very negative perfomance impact (one request &
  data handling for each tour)
  → his fix should be  replaced again soon

Refs tdeuling#18
  • Loading branch information
pixelbrackets committed Feb 27, 2018
1 parent 9833c2b commit b485092
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions Resources/Public/JavaScript/BootstrapTourController.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,11 @@ define(['jquery', 'TYPO3/CMS/Guide/BootstrapTourParser', 'TYPO3/CMS/Guide/Logger
// Get all available tours via Ajax
top.TYPO3.Guide.TourData = result.tours;

// Initialize core tours, if available
if(typeof(top.TYPO3.Guide.TourData['Tree']) !== 'undefined') {
top.TYPO3.Guide.loadTour('Tree', false);
}
if(typeof(top.TYPO3.Guide.TourData['Menu']) !== 'undefined') {
top.TYPO3.Guide.loadTour('Menu', false);
}
if(typeof(top.TYPO3.Guide.TourData['Topbar']) !== 'undefined') {
top.TYPO3.Guide.loadTour('Topbar', false);
// Bugfix: Always initialize *all* tours because of the
// required tour data may be missing upon startTour() execution
for (var key in top.TYPO3.Guide.TourData) {
top.TYPO3.Guide.loadTour(key);
Logger.log('Init tour on start already: ', key);
}
}
});
Expand All @@ -366,15 +362,7 @@ define(['jquery', 'TYPO3/CMS/Guide/BootstrapTourParser', 'TYPO3/CMS/Guide/Logger
// Restart a tour
else if(typeof top.TYPO3.Guide.restartTourName !== 'undefined' && top.TYPO3.Guide.restartTourName !== '') {
// First end some tours
if(typeof(top.TYPO3.Guide.TourData['Tree']) !== 'undefined') {
top.TYPO3.Guide.Tours.Tree.end();
}
if(typeof(top.TYPO3.Guide.TourData['Menu']) !== 'undefined') {
top.TYPO3.Guide.Tours.Menu.end();
}
if(typeof(top.TYPO3.Guide.TourData['Topbar']) !== 'undefined') {
top.TYPO3.Guide.Tours.Topbar.end();
}
top.TYPO3.Guide.end();
// Now grab the reminded tour
top.TYPO3.Guide.currentTourName = top.TYPO3.Guide.restartTourName;
top.TYPO3.Guide.restartTourName = '';
Expand Down

0 comments on commit b485092

Please sign in to comment.