mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-31 02:28:09 +08:00
Tours changes, es6 template strings.
This commit is contained in:
@@ -12,6 +12,20 @@ define(['libs/bootstrap-tour'],function(BootstrapTour) {
|
||||
|
||||
var gxy_root = typeof Galaxy === "undefined" ? '/' : Galaxy.root;
|
||||
|
||||
var tourpage_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>`;
|
||||
|
||||
var tour_opts = { storage: window.sessionStorage,
|
||||
onEnd: function(){
|
||||
sessionStorage.removeItem('activeGalaxyTour');
|
||||
@@ -94,20 +108,7 @@ define(['libs/bootstrap-tour'],function(BootstrapTour) {
|
||||
},
|
||||
|
||||
render: function(){
|
||||
var tpl = _.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(''));
|
||||
var tpl = _.template(tourpage_template);
|
||||
this.$el.html(tpl({tours: this.model.models})).on("click", ".tourItem", function(e){
|
||||
e.preventDefault();
|
||||
giveTour($(this).data("tour.id"));
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
"use strict";define(["libs/bootstrap-tour"],function(t){var e="undefined"==typeof Galaxy?"/":Galaxy.root,o={storage:window.sessionStorage,onEnd:function(){sessionStorage.removeItem("activeGalaxyTour")},delay:150,orphan:!0},n=function(t){return _.each(t.steps,function(t){t.preclick&&(t.onShow=function(){_.each(t.preclick,function(t){$(t).click()})}),t.postclick&&(t.onHide=function(){_.each(t.postclick,function(t){$(t).click()})}),t.textinsert&&(t.onShown=function(){$(t.element).val(t.textinsert).trigger("change")})}),t},i=Backbone.Model.extend({urlRoot:e+"api/tours"}),r=Backbone.Collection.extend({url:e+"api/tours",model:i}),a=function(t){var i=e+"api/tours/"+t;$.getJSON(i,function(t){var e=n(t);sessionStorage.setItem("activeGalaxyTour",JSON.stringify(t));var i=new Tour(_.extend({steps:e.steps},o));i.init(),i.goTo(0),i.restart()})};return{ToursView:Backbone.View.extend({initialize:function(){var t=this;this.setElement("<div/>"),this.model=new r,this.model.fetch({success:function(){t.render()},error:function(){console.error("Failed to fetch tours.")}})},render:function(){var t=_.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(t({tours:this.model.models})).on("click",".tourItem",function(t){t.preventDefault(),a($(this).data("tour.id"))})}}),hooked_tour_from_data:n,tour_opts:o,giveTour:a}});
|
||||
"use strict";define(["libs/bootstrap-tour"],function(t){var e="undefined"==typeof Galaxy?"/":Galaxy.root,o={storage:window.sessionStorage,onEnd:function(){sessionStorage.removeItem("activeGalaxyTour")},delay:150,orphan:!0},n=function(t){return _.each(t.steps,function(t){t.preclick&&(t.onShow=function(){_.each(t.preclick,function(t){$(t).click()})}),t.postclick&&(t.onHide=function(){_.each(t.postclick,function(t){$(t).click()})}),t.textinsert&&(t.onShown=function(){$(t.element).val(t.textinsert).trigger("change")})}),t},i=Backbone.Model.extend({urlRoot:e+"api/tours"}),r=Backbone.Collection.extend({url:e+"api/tours",model:i}),a=function(t){var i=e+"api/tours/"+t;$.getJSON(i,function(t){var e=n(t);sessionStorage.setItem("activeGalaxyTour",JSON.stringify(t));var i=new Tour(_.extend({steps:e.steps},o));i.init(),i.goTo(0),i.restart()})};return{ToursView:Backbone.View.extend({initialize:function(){var t=this;this.setElement("<div/>"),this.model=new r,this.model.fetch({success:function(){t.render()},error:function(){console.error("Failed to fetch tours.")}})},render:function(){var t=_.template('<h2>Galaxy Tours</h2>\n<p>This page presents a list of interactive tours available on this Galaxy server.\nSelect any tour to get started (and remember, you can click \'End Tour\' at any time).</p>\n<ul>\n<% _.each(tours, function(tour) { %>\n <li>\n <a href="/tours/<%- tour.id %>" class="tourItem" data-tour.id=<%- tour.id %>>\n <%- tour.attributes.name || tour.id %>\n </a>\n - <%- tour.attributes.description || "No description given." %>\n </li>\n<% }); %>\n</ul>');this.$el.html(t({tours:this.model.models})).on("click",".tourItem",function(t){t.preventDefault(),a($(this).data("tour.id"))})}}),hooked_tour_from_data:n,tour_opts:o,giveTour:a}});
|
||||
//# sourceMappingURL=../../maps/mvc/tours.js.map
|
||||
|
||||
Reference in New Issue
Block a user