mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
define(["libs/bootstrap-tour"],function(){var a="undefined"==typeof Galaxy?"/":Galaxy.root,b={storage:window.sessionStorage,onEnd:function(){sessionStorage.removeItem("activeGalaxyTour")},delay:150,orphan:!0},c=function(a){return _.each(a.steps,function(a){a.preclick&&(a.onShow=function(){_.each(a.preclick,function(a){$(a).click()})}),a.postclick&&(a.onNext=function(){_.each(a.postclick,function(a){$(a).click()})}),a.textinsert&&(a.onShown=function(){$(a.element).val(a.textinsert).trigger("change")})}),a},d=Backbone.Model.extend({urlRoot:a+"api/tours"}),e=Backbone.Collection.extend({url:a+"api/tours",model:d}),f=function(d){var e=a+"api/tours/"+d;$.getJSON(e,function(a){var d=c(a);sessionStorage.setItem("activeGalaxyTour",JSON.stringify(a));var e=new Tour(_.extend({steps:d.steps},b));e.init(),e.goTo(0),e.restart()})},g=Backbone.View.extend({title:"Tours",initialize:function(){var a=this;this.setElement("<div/>"),this.model=new e,this.model.fetch({success:function(){a.render()},error:function(){console.error("Failed to fetch tours.")}})},render:function(){var a=_.template(["<h2>Galaxy Tours</h2>","<p>This page presents a list of interactive tours available on this Galaxy server. ","Select any tour to get started (and remember, you can click 'End Tour' at any time).</p>","<ul>","<% _.each(tours, function(tour) { %>","<li>",'<a href="/tours/<%- tour.id %>" class="tourItem" data-tour.id=<%- tour.id %>>',"<%- tour.attributes.name || tour.id %>","</a>",' - <%- tour.attributes.description || "No description given." %>',"</li>","<% }); %>","</ul>"].join(""));this.$el.html(a({tours:this.model.models})).on("click",".tourItem",function(a){a.preventDefault(),f($(this).data("tour.id"))})}});return{ToursView:g,hooked_tour_from_data:c,tour_opts:b,giveTour:f}});
|
|
//# sourceMappingURL=../../maps/mvc/tours.js.map
|