Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

de-dupe icons #4604

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion _plugins/author-page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions _plugins/gtn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion _plugins/gtn/contributors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<div class="row">
{% for icon in site["icon-tag"] %}
{% assign icon_groups = site['icon-tag'] | group_icons %}
{% for icon in icon_groups %}
<div class="col-md-2 col-sm-3" style="text-align: center">
<div style="font-size: 400%">{% icon_var icon[0] %}</div>
<div>{{ icon[0] }}</div>
<div style="font-size: 400%">{% icon_var icon[0][0] %}</div>
<div>{% for z in icon[0] %}{{ z }}{%unless forloop.last%},{%endunless%} {% endfor %}</div>
</div>
{% endfor %}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<div class="row">
{% for icon in site["icon-tag"] %}
{% assign icon_groups = site['icon-tag'] | group_icons %}
{% for icon in icon_groups %}
<div class="col-md-2 col-sm-3" style="text-align: center">
<div style="font-size: 400%">{% icon_var icon[0] %}</div>
<div>{{ icon[0] }}</div>
<div style="font-size: 400%">{% icon_var icon[0][0] %}</div>
<div>{% for z in icon[0] %}{{ z }}{%unless forloop.last%},{%endunless%} {% endfor %}</div>
</div>
{% endfor %}
</div>
Expand Down
Loading