Skip to content

Commit b309593

Browse files
davidlange6pre-commit-ci[bot]henryiii
authored
add team pictures to the focus area pages (#750)
* add team pictures to the focus area pages * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: move core logic to Ruby * refactor: use find instead of manual loops Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner <[email protected]> Co-authored-by: Henry Schreiner <[email protected]>
1 parent c2093e0 commit b309593

File tree

3 files changed

+40
-22
lines changed

3 files changed

+40
-22
lines changed

Diff for: _includes/list_project_team.html

+12-22
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,21 @@ <h3>Team</h3>
1010
{%- endif -%}
1111

1212
{% for contact in include.team %}
13-
{% assign written = false %}
14-
{% if contact contains "](" %}
13+
{% assign person = site.data.people | find: "shortname", contact %}
14+
15+
{% if person %}
16+
{%- if inline and person.e-mail -%}
17+
{{ li }} <a href="mailto:{{person.e-mail}}">{{person.name}}</a> {{ eli }}
18+
{%- elsif person.website -%}
19+
{{ li }} <a href="{{person.website}}">{{ person.name }}</a> {{ eli }}
20+
{% else %}
21+
{{ li }} {{person.name}} {{ eli }}
22+
{% endif %}
1523
{% elsif contact contains "@" %}
1624
<a href="mailto:{{contact}}"> <em>{{contact}}</em> </a>
17-
{% assign written = true %}
18-
{% else %}
19-
{% for person_hash in site.data.people -%}
20-
{% assign person = person_hash[1] -%}
21-
{% if person.shortname == contact %}
22-
{%- if inline and person.e-mail -%}
23-
{{ li }} <a href="mailto:{{person.e-mail}}">{{person.name}}</a> {{ eli }}
24-
{% assign written = true %}
25-
{%- elsif person.website -%}
26-
{{ li }} <a href="{{person.website}}">{{ person.name }}</a> {{ eli }}
27-
{% assign written = true %}
28-
{% else %}
29-
{{ li }} {{person.name}} {{ eli }}
30-
{% assign written = true %}
31-
{% endif %}
32-
{% endif %}
33-
{% endfor %}
34-
{% endif %}
35-
{% unless written %}
25+
{{ else }}
3626
{{ li }} {{ contact | markdownify | remove: '<p>' | remove: '</p>' }} {{ eli }}
37-
{% endunless %}
27+
{% endif %}
3828
{% endfor %}
3929

4030
{%- unless include.inline %}

Diff for: _layouts/focus-area.html

+20
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616
{% assign page_focus_area = page.name | basename %}
1717
{% assign sorted = site.pages | smart_page_sort: "focus-area", page_focus_area %}
1818

19+
{% assign fa_team = sorted | get_set: "team" | sort | key_to_value: site.data.people %}
20+
21+
{% unless fa_team.empty %}
22+
<div class="container-fluid">
23+
<div class="row">
24+
{% for person in fa_team %}
25+
<div class="card" style="font-size:10px;width: 87px;height: 135px;margin-bottom:-15px;">
26+
<img style="width: 85px;height: 85px; object-fit:cover;" src="{{person.photo}}" alt="Card image cap">
27+
{%- if person.website -%}
28+
<a href="{{person.website}}">{{ person.name }}</a>
29+
{%- else -%}
30+
{{ person.name }}
31+
{%- endif -%}
32+
</div>
33+
{% endfor %}
34+
</div>
35+
<br>
36+
</div>
37+
{% endunless %}
38+
1939
{% unless sorted.empty %}
2040
<div class="container-fluid projects">
2141
<h2 class="alt-h2 text-center mb-3 mt-lg-6" id="projects">{{ page.short_title | upcase }} Projects</h2><br>

Diff for: _plugins/smart_sort.rb

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ def smart_page_sort(input, field, match)
77
input.select { |p| p['pagetype'] == 'project' && p[field].include?(match) }
88
.sort_by { |p| [p['position'] || 0, p['title'].downcase] }
99
end
10+
11+
def get_set(input, key)
12+
input.flat_map { |p| p[key] || [] }.uniq
13+
end
14+
15+
def key_to_value(input, hash)
16+
input.map { |k| hash.fetch(k, nil) }.compact
17+
end
1018
end
1119
end
1220

0 commit comments

Comments
 (0)