diff --git a/client/galaxy/scripts/apps/analysis.js b/client/galaxy/scripts/apps/analysis.js index f4b6ab3ac19..08d3d12f16c 100644 --- a/client/galaxy/scripts/apps/analysis.js +++ b/client/galaxy/scripts/apps/analysis.js @@ -76,7 +76,7 @@ window.app = function app(options, bootstrapped) { show_tours: function(tour_id) { if (tour_id) { - Tours.giveTour(tour_id); + Tours.giveTourById(tour_id); } else { this.page.display(new Tours.ToursView()); } diff --git a/client/galaxy/scripts/mvc/tours.js b/client/galaxy/scripts/mvc/tours.js index 82a6f7cd24e..947161e7f6f 100644 --- a/client/galaxy/scripts/mvc/tours.js +++ b/client/galaxy/scripts/mvc/tours.js @@ -96,25 +96,24 @@ var Tours = Backbone.Collection.extend({ model: TourItem }); -var giveTour = tour_id => { - var url = `${gxy_root}api/tours/${tour_id}`; - $.getJSON(url, data => { - // Set hooks for additional click and data entry actions. - var tourdata = hooked_tour_from_data(data); +let startTourWithData = data => { + let hookedTourData = hooked_tour_from_data(data); sessionStorage.setItem("activeGalaxyTour", JSON.stringify(data)); // Store tour steps in sessionStorage to easily persist w/o hackery. - var tour = new Tour( - _.extend( - { - steps: tourdata.steps - }, - tour_opts - ) + let tour = new Tour( + _.extend({steps: hookedTourData.steps}, + tour_opts) ); - // Always clean restart, since this is a new, explicit giveTour execution. + // Always clean restart, since this is a new, explicit execution. tour.init(); tour.goTo(0); tour.restart(); +}; + +var giveTourById = tour_id => { + var url = `${gxy_root}api/tours/${tour_id}`; + $.getJSON(url, data => { + startTourWithData(data); }); }; @@ -168,7 +167,7 @@ var ToursView = Backbone.View.extend({ ) .on("click", ".tourItem", function(e) { e.preventDefault(); - giveTour($(this).data("tour.id")); + giveTourById($(this).data("tour.id")); }) .on("click", ".tag-selector-button", e => { var elem = $(e.target); @@ -214,6 +213,6 @@ export function activeGalaxyTourRunner() { export default { ToursView: ToursView, hooked_tour_from_data: hooked_tour_from_data, - giveTour: giveTour, + giveTourById: giveTourById, activeGalaxyTourRunner: activeGalaxyTourRunner };