Skip to content

Commit

Permalink
Merge pull request #4379 from galaxyproject/lion-uaru
Browse files Browse the repository at this point in the history
Topic embeds, topics by tag
  • Loading branch information
nomadscientist authored Oct 6, 2023
2 parents 62f51f2 + e62b3a4 commit 4ed4fde
Show file tree
Hide file tree
Showing 20 changed files with 502 additions and 71 deletions.
5 changes: 4 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ template-and-tools:
# topic labels
admin:
- topics/admin/**/*
ai4life:
- topics/ai4life/**/*
assembly:
- topics/assembly/**/*
climate:
Expand All @@ -29,6 +31,8 @@ epigenetics:
- topics/epigenetics/**/*
evolution:
- topics/evolution/**/*
fair:
- topics/fair/**/*
galaxy-interface:
- topics/galaxy-interface/**/*
genome-annotation:
Expand Down Expand Up @@ -61,4 +65,3 @@ variant-analysis:
- topics/variant-analysis/**/*
visualisation:
- topics/visualisation/**/*

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ annotate: ## annotate the tutorials with usable Galaxy instances
${ACTIVATE_ENV} && \
wget https://github.com/hexylena/toolshed-version-database/raw/main/guid-rev.json -O metadata/toolshed-revisions.json && \
python bin/supported-fetch.py
bin/workflows-fetch.rb
.PHONY: annotate

rebuild-search-index: ## Rebuild search index
Expand Down
66 changes: 31 additions & 35 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@

{% assign contributors = site.data['contributors'] %}

{% assign sorted_topics = "" | split: "," %}
{% assign sorted_topics_pre = site.data | sort | order: "title" %}

{% for topic in sorted_topics_pre %}
{% if topic[0] == "introduction" %}
{% assign sorted_topics = sorted_topics | unshift: topic %}
{% else %}
{% assign sorted_topics = sorted_topics | push: topic %}
{% endif %}
{% endfor %}
{% assign sorted_topics = site | list_topics_ids %}

<section>
<h1>Welcome to {{ site.title }}</h1>
Expand Down Expand Up @@ -49,12 +40,13 @@ <h2>Galaxy for Scientists</h2>
</tr>
</thead>
<tbody>
{% for topic in sorted_topics %}
{% if topic[1].type == "use" %}
{% if topic[1].draft != true or jekyll.environment != "production" %}
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "use" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter:topic[1].name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic[1].name }}/">{{ topic[1].title }}</a>{% if topic[1].draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
{% assign tutorial_number = site | topic_filter_tutorial_count:topic.name %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
Expand All @@ -72,12 +64,13 @@ <h2>Galaxy Tips & Tricks</h2>
</tr>
</thead>
<tbody>
{% for topic in sorted_topics %}
{% if topic[1].type == "basics" %}
{% if topic[1].draft != true or jekyll.environment != "production" %}
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "basics" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter:topic[1].name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic[1].name }}/">{{ topic[1].title }}</a>{% if topic[1].draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
{% assign tutorial_number = site | topic_filter:topic.name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
Expand All @@ -95,12 +88,13 @@ <h2>Data Science Survival Kit</h2>
</tr>
</thead>
<tbody>
{% for topic in sorted_topics %}
{% if topic[1].type == "data-science" %}
{% if topic[1].draft != true or jekyll.environment != "production" %}
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "data-science" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter:topic[1].name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic[1].name }}/">{{ topic[1].title }}</a>{% if topic[1].draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
{% assign tutorial_number = site | topic_filter:topic.name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
Expand All @@ -118,12 +112,13 @@ <h2>Galaxy for Developers and Admins</h2>
</tr>
</thead>
<tbody>
{% for topic in sorted_topics %}
{% if topic[1].type == "admin-dev" %}
{% if topic[1].draft != true or jekyll.environment != "production" %}
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "admin-dev" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter:topic[1].name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic[1].name }}/">{{ topic[1].title }}</a>{% if topic[1].draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
{% assign tutorial_number = site | topic_filter:topic.name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
Expand All @@ -149,12 +144,13 @@ <h2>Galaxy for Contributors and Instructors</h2>
</tr>
</thead>
<tbody>
{% for topic in sorted_topics %}
{% if topic[1].type == "instructors" %}
{% if topic[1].draft != true or jekyll.environment != "production" %}
{% for topic_name in sorted_topics %}
{% assign topic = site.data[topic_name] %}
{% if topic.type == "instructors" %}
{% if topic.draft != true or jekyll.environment != "production" %}
<tr>
{% assign tutorial_number = site | topic_filter:topic[1].name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic[1].name }}/">{{ topic[1].title }}</a>{% if topic[1].draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
{% assign tutorial_number = site | topic_filter:topic.name | topic_count %}
<td><a href="{{ site.baseurl }}/topics/{{ topic.name }}/">{{ topic.title }}</a>{% if topic.draft %} <div class="label label-default tutorial_tag" style="{{ 'work-in-progress' | colour_tag }}">work-in-progress</div>{% endif %}</td>
<td>{{ tutorial_number }}</td>
</tr>
{% endif %}
Expand Down
20 changes: 20 additions & 0 deletions _layouts/topic-embed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: embed
---

<section class="tutorials-list {{ page.topic_name }} topic-type-{{ topic.type }}">

{% assign topic = site.data[page.topic_name] | default: page.topic %}
{% assign topic_material = site | list_materials_structured:page.topic_name %}

{% for subtopic in topic_material %}
{% if subtopic[0] != "__FLAT__" %}
<h3 id="st-{{ subtopic[0] | slugify }}">{{ subtopic[1].subtopic.title }}</h3>
<p>{{ subtopic[1].subtopic.description }}</p>
{% endif %}

{% include _includes/tutorial_list.html sub=subtopic %}
{% endfor %}

{{ content }}
</section>
11 changes: 5 additions & 6 deletions _layouts/topic.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
layout: base
---

{% assign topic = site.data[page.topic_name] %}
{% assign contributors = site.data['contributors'] %}
{% assign instances = site.data['instances'] %}
{% assign language = site.other_languages %}
{% assign topic_material = site | list_materials_structured:page.topic_name %}
{% assign topic = site.data[page.topic_name] | default: page.topic %}
{% assign topic_material = site | list_materials_structured:topic.name %}

<!-- Gitter -->
{% if topic.gitter %}
Expand All @@ -15,7 +12,7 @@
{% assign gitter = site.gitter_url %}
{% endif %}

<section class="tutorials-list {{ page.topic_name }} topic-type-{{ topic.type }}">
<section class="tutorials-list {{ topic.name }} topic-type-{{ topic.type }}">
<h1>{{ topic.title }}</h1>
<p>{{ topic.summary | markdownify }}</p>
<i>You can view the tutorial materials in different languages by clicking the dropdown icon next to the slides ({% icon slides %}) and tutorial ({% icon tutorial %}) buttons below. </i>
Expand Down Expand Up @@ -61,10 +58,12 @@ <h2 id="topic-faq">Frequently Asked Questions</h2>
Common questions regarding this topic have been collected on a <a href="faqs/">dedicated FAQ page </a>. Common questions related to specific tutorials can be accessed from the tutorials themselves.
{% endunless %}

{% if topic.editorial_board %}
<h2 id="editorial-board">Editorial Board</h2>
<p>This material is reviewed by our Editorial Board:</p>
{% assign editorial_board = topic.editorial_board | sorted %}
{% include _includes/contributor-list.html contributors=editorial_board badge=true %}
{% endif %}

<p>
<em>For any question related to this topic and the content, you can contact them or visit our <a href="https://gitter.im/Galaxy-Training-Network/Lobby">Gitter channel</a>.</em>
Expand Down
11 changes: 8 additions & 3 deletions _plugins/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def generate(site)
out = site.data[topic].dup
out['materials'] = TopicFilter.topic_filter(site, topic).map do |x|
q = x.dup
q['contributors'] = get_contributors(q).dup.map { |c| mapContributor(site, c) }
q['contributors'] = get_contributors(q).dup.map do |c|
mapContributor(site, c)
end

q['urls'] = {}

Expand All @@ -221,9 +223,12 @@ def generate(site)

q
end
out['editorial_board'] = out['editorial_board'].map { |c| mapContributor(site, c) }
out['editorial_board'] = out['editorial_board'].map do |c|
mapContributor(site, c)
end

page2 = PageWithoutAFile.new(site, '', 'api/topics/', "#{topic}.json")
page2 = PageWithoutAFile.new(site, '', 'api/topics/',
"#{topic}.json")
page2.content = JSON.pretty_generate(out)
page2.data['layout'] = nil
site.pages << page2
Expand Down
46 changes: 46 additions & 0 deletions _plugins/by-tag-pages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require './_plugins/jekyll-topic-filter'

module Jekyll
##
# This class generates the GTN's author pags
class TagPageGenerator < Generator
safe true

##
# This generates the author pages
# Params
# +site+:: The site object
def generate(site)
Jekyll.logger.info '[GTN/SyntheticTopics] Generating By-Tag Indexes'
TopicFilter.list_all_tags(site).map do |tag|
site.data["by_tag_#{tag}"] = {
'name' => "by_tag_#{tag}",
'type' => 'use',
'title' => tag,
'summary' => "Tutorials covering #{tag}",
'tag_based' => true,
'hidden' => true,
}

topic_index = PageWithoutAFile.new(site, '', "tags/#{tag}", 'index.md')
topic_index.content = ''
topic_index.data['layout'] = 'topic'
topic_index.data['topic_name'] = "by_tag_#{tag}"
topic_index.data['topic'] = site.data["by_tag_#{tag}"]

site.pages << topic_index
end

Jekyll.logger.info '[GTN/SyntheticTopics] Generating By-Tag Embeds'
TopicFilter.list_all_tags(site).map do |tag|
topic_index = PageWithoutAFile.new(site, '', "tags/#{tag}", 'embed.html')
topic_index.content = ''
topic_index.data['layout'] = 'topic-embed'
topic_index.data['topic_name'] = "by_tag_#{tag}"
topic_index.data['topic'] = site.data["by_tag_#{tag}"]

site.pages << topic_index
end
end
end
end
4 changes: 1 addition & 3 deletions _plugins/gtn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ def regex_replace_once(str, regex_search, value_replace)

def convert_to_material_list(site, materials)
# [{"name"=>"introduction", "topic"=>"admin"}]
if materials.nil?
return []
end
return [] if materials.nil?

materials.map do |m|
if m.key?('name') && m.key?('topic')
Expand Down
4 changes: 2 additions & 2 deletions _plugins/gtn/synthetic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ module Jekyll
class SyntheticTopicGenerator < Generator
def generate(site)
# Full Bibliography
puts '[GTN/SyntheticTopics] Generating Indexes'
Jekyll.logger.info '[GTN/SyntheticTopics] Generating Indexes'

TopicFilter.list_topics(site).select { |t| site.data[t]['tag_based'] }.each do |topic|
puts "[GTN/SyntheticTopics] Creating #{topic} topic"
Jekyll.logger.debug "[GTN/SyntheticTopics] Creating #{topic} topic"

topic_index = PageWithoutAFile.new(site, '', "topics/#{topic}", 'index.md')
topic_index.content = ''
Expand Down
Loading

0 comments on commit 4ed4fde

Please sign in to comment.