From 523d3aa8003baa8384574c1ce5fdb1fbbccd17f7 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Mon, 18 Dec 2023 12:09:12 +0100 Subject: [PATCH 1/3] de-dupe icons --- _config.yml | 2 +- _plugins/author-page.rb | 2 +- _plugins/gtn.rb | 4 ++++ _plugins/gtn/contributors.rb | 5 ++++- .../create-new-tutorial-content/faqs/icons_list.md | 9 ++++++--- .../tutorials/create-new-tutorial-content/tutorial.md | 9 ++++++--- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/_config.yml b/_config.yml index 831eea08f1ae14..70440578cb4d3d 100644 --- a/_config.yml +++ b/_config.yml @@ -170,7 +170,7 @@ icon-tag: point-right: far fa-hand-point-right pref-info: fas fa-user pref-password: fas fa-unlock-alt - pref-identities: far fa-id-card-o + pref-identities: far fa-id-card pref-permissions: fas fa-users pref-dataprivate: fas fa-lock pref-apikey: fas fa-key diff --git a/_plugins/author-page.rb b/_plugins/author-page.rb index 6cdb7a4c0e9234..87d9997f70ea41 100644 --- a/_plugins/author-page.rb +++ b/_plugins/author-page.rb @@ -81,7 +81,7 @@ def generate(site) pusher(t, news_by_author, true) if t['layout'] == 'news' end - Gtn::Contributors.list(site).reject { |c| c['halloffame'] == 'no' }.each_key do |contributor| + Gtn::Contributors.list(site).each_key do |contributor| # Using PageWithoutAFile instead of a custom class which reads files # from disk each time, saves some time, but it is unclear how much # due to how the previous was accounted. But assuming 0.040s per page * 193 should be about 8 seconds. diff --git a/_plugins/gtn.rb b/_plugins/gtn.rb index ecea8205fb6e58..25256989aaa0ae 100644 --- a/_plugins/gtn.rb +++ b/_plugins/gtn.rb @@ -417,6 +417,10 @@ def get_default_link(material) url end + + def group_icons(icons) + icons.group_by{|k, v| v}.map{|k, v| [k, v.map{|z|z[0]} ]}.to_h.invert + end end end diff --git a/_plugins/gtn/contributors.rb b/_plugins/gtn/contributors.rb index 5c5403397a5875..53d3ab77079c9e 100644 --- a/_plugins/gtn/contributors.rb +++ b/_plugins/gtn/contributors.rb @@ -119,7 +119,10 @@ def self.fetch_name(site, c) # Returns: # +Hash+ of contributors, funders, organisations merged together def self.list(site) - site.data['contributors'].merge(site.data['funders']).merge(site.data['organisations']) + site.data['contributors'] + .merge(site.data['funders']) + .merge(site.data['organisations']) + .reject{|c| c['halloffame'] == 'no' } end ## diff --git a/topics/contributing/tutorials/create-new-tutorial-content/faqs/icons_list.md b/topics/contributing/tutorials/create-new-tutorial-content/faqs/icons_list.md index 651dc42e4da411..014a3a990c62cd 100644 --- a/topics/contributing/tutorials/create-new-tutorial-content/faqs/icons_list.md +++ b/topics/contributing/tutorials/create-new-tutorial-content/faqs/icons_list.md @@ -12,13 +12,16 @@ To use icons in your tutorial, take the name of the icon, 'details' in this exam {% raw %}{% icon details %}{% endraw %} ``` +Some icons have multiple aliases, any may be used, but we'd suggest trying to choose the most semantically appropriate one in case Galaxy later decides to change the icon. + The following icons are currently available:
-{% for icon in site["icon-tag"] %} +{% assign icon_groups = site['icon-tag'] | group_icons %} +{% for icon in icon_groups %}
-
{% icon_var icon[0] %}
-
{{ icon[0] }}
+
{% icon_var icon[0][0] %}
+
{% for z in icon[0] %}{{ z }}{%unless forloop.last%},{%endunless%} {% endfor %}
{% endfor %}
diff --git a/topics/contributing/tutorials/create-new-tutorial-content/tutorial.md b/topics/contributing/tutorials/create-new-tutorial-content/tutorial.md index dfeb80218e11b7..46da2f522b84ad 100644 --- a/topics/contributing/tutorials/create-new-tutorial-content/tutorial.md +++ b/topics/contributing/tutorials/create-new-tutorial-content/tutorial.md @@ -1054,11 +1054,14 @@ To use these icons, take the name of the icon, 'details' in this example, and wr {% raw %}{% icon details %}{% endraw %} ``` +Some icons have multiple aliases, any may be used, but we'd suggest trying to choose the most semantically appropriate one in case Galaxy later decides to change the icon. +
-{% for icon in site["icon-tag"] %} +{% assign icon_groups = site['icon-tag'] | group_icons %} +{% for icon in icon_groups %}
-
{% icon_var icon[0] %}
-
{{ icon[0] }}
+
{% icon_var icon[0][0] %}
+
{% for z in icon[0] %}{{ z }}{%unless forloop.last%},{%endunless%} {% endfor %}
{% endfor %}
From b560419afbf8a200bf91302549094460461643f7 Mon Sep 17 00:00:00 2001 From: Helena Date: Wed, 20 Dec 2023 12:43:45 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- _plugins/gtn/contributors.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_plugins/gtn/contributors.rb b/_plugins/gtn/contributors.rb index 53d3ab77079c9e..d4b47b8a4b2126 100644 --- a/_plugins/gtn/contributors.rb +++ b/_plugins/gtn/contributors.rb @@ -120,9 +120,9 @@ def self.fetch_name(site, c) # +Hash+ of contributors, funders, organisations merged together def self.list(site) site.data['contributors'] - .merge(site.data['funders']) - .merge(site.data['organisations']) - .reject{|c| c['halloffame'] == 'no' } + .merge(site.data['funders']) + .merge(site.data['organisations']) + .reject {|c| c['halloffame'] == 'no' } end ## From 53bd39768bdb9112202a88a26c5294653124d6f5 Mon Sep 17 00:00:00 2001 From: Helena Date: Wed, 20 Dec 2023 12:45:51 +0100 Subject: [PATCH 3/3] Update _plugins/gtn/contributors.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- _plugins/gtn/contributors.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_plugins/gtn/contributors.rb b/_plugins/gtn/contributors.rb index d4b47b8a4b2126..f1a2646850b545 100644 --- a/_plugins/gtn/contributors.rb +++ b/_plugins/gtn/contributors.rb @@ -122,7 +122,7 @@ def self.list(site) site.data['contributors'] .merge(site.data['funders']) .merge(site.data['organisations']) - .reject {|c| c['halloffame'] == 'no' } + .reject { |c| c['halloffame'] == 'no' } end ##