mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Added tour groups for more clarity if there are a lot of tours.
This commit is contained in:
@@ -9,16 +9,25 @@ define(["libs/bootstrap-tour"], function(BootstrapTour) {
|
||||
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) { %>
|
||||
<% _.each(tourgroups, function(tourgroupdata) { %>
|
||||
<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." %>
|
||||
<span>
|
||||
<%- tourgroupdata.attributes.name %>
|
||||
</span>
|
||||
<ul>
|
||||
<% _.each(tourgroupdata.attributes.tours, function(tour) { %>
|
||||
<li>
|
||||
<a href="/tours/<%- tour.id %>" class="tourItem" data-tour.id=<%- tour.id %>>
|
||||
<%- tour.name || tour.id %>
|
||||
</a>
|
||||
- <%- tour.description || \"No description given.\" %>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>`;
|
||||
<% }); %>`;
|
||||
|
||||
var tour_opts = {
|
||||
storage: window.sessionStorage,
|
||||
@@ -112,7 +121,7 @@ Select any tour to get started (and remember, you can click 'End Tour' at any ti
|
||||
render: function() {
|
||||
var tpl = _.template(tourpage_template);
|
||||
this.$el
|
||||
.html(tpl({ tours: this.model.models }))
|
||||
.html(tpl({ tourgroups: this.model.models }))
|
||||
.on("click", ".tourItem", function(e) {
|
||||
e.preventDefault();
|
||||
giveTour($(this).data("tour.id"));
|
||||
|
||||
@@ -2,6 +2,8 @@ id: galaxy_ui
|
||||
name: Galaxy UI
|
||||
description: A gentle introduction to the Galaxy User Interface
|
||||
title_default: "Welcome to Galaxy"
|
||||
group: galaxy_default
|
||||
group_name: "Galaxy Default Tours"
|
||||
|
||||
# A tour is made of several steps, each of them beginning with a dash '-'
|
||||
steps:
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
name: History Introduction
|
||||
description: A detailed introduction to the Galaxy History
|
||||
title_default: "Galaxy History Introduction"
|
||||
group: galaxy_default
|
||||
group_name: "Galaxy Default Tours"
|
||||
|
||||
steps:
|
||||
- content: "This short tour will guide you through <b>Galaxy's History</b> and datasets."
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
name: Scratchbook - Introduction
|
||||
title_default: "Scratchbook Introduction"
|
||||
description: "An introduction on how to display multiple datasets and visualizations next to each other."
|
||||
group: galaxy_default
|
||||
group_name: "Galaxy Default Tours"
|
||||
|
||||
steps:
|
||||
- content: "This short tour will walk you through <b>Galaxy's Scratchbook</b> feature"
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
name: Test Tour
|
||||
description: Test Tour for no reason
|
||||
title_default: "Test Tour"
|
||||
group: test_tours
|
||||
group_name: "Test Tours"
|
||||
|
||||
steps:
|
||||
- content: "Test tour."
|
||||
@@ -33,10 +33,14 @@ class ToursRegistry(object):
|
||||
self.load_tours()
|
||||
|
||||
def tours_by_id_with_description(self):
|
||||
return [{'id': k,
|
||||
'description': self.tours[k].get('description', None),
|
||||
'name': self.tours[k].get('name', None)}
|
||||
for k in self.tours.keys()]
|
||||
return [{'name': self.tourgroups[i].get('name', None),
|
||||
'tours': [{'id': k,
|
||||
'description': self.tours[k].get('description', None),
|
||||
'name': self.tours[k].get('name', None),
|
||||
'group': self.tours[k].get('group_name', None)}
|
||||
for k in self.tours.keys()
|
||||
if self.tours[k].get('group', None) == i]}
|
||||
for i in self.tourgroups.keys()]
|
||||
|
||||
def load_tour(self, tour_id):
|
||||
for tour_dir in self.tour_directories:
|
||||
@@ -52,6 +56,7 @@ class ToursRegistry(object):
|
||||
|
||||
def load_tours(self):
|
||||
self.tours = {}
|
||||
self.tourgroups = {}
|
||||
for tour_dir in self.tour_directories:
|
||||
for filename in os.listdir(tour_dir):
|
||||
if filename.endswith('.yaml') or filename.endswith('.yml'):
|
||||
@@ -71,6 +76,9 @@ class ToursRegistry(object):
|
||||
conf = yaml.safe_load(handle)
|
||||
tour = tour_loader(conf)
|
||||
self.tours[tour_id] = tour_loader(conf)
|
||||
if tour['group'] not in self.tourgroups.keys():
|
||||
self.tourgroups[tour['group']] = {'name': tour['group_name'], 'tours': []}
|
||||
self.tourgroups[tour['group']]['tours'].append(tour_id)
|
||||
log.info("Loaded tour '%s'" % tour_id)
|
||||
return tour
|
||||
except IOError:
|
||||
|
||||
Reference in New Issue
Block a user