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

add team pictures to the focus area pages #750

Merged
merged 6 commits into from
May 4, 2021
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
34 changes: 12 additions & 22 deletions _includes/list_project_team.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,21 @@ <h3>Team</h3>
{%- endif -%}

{% for contact in include.team %}
{% assign written = false %}
{% if contact contains "](" %}
{% assign person = site.data.people | find: "shortname", contact %}

{% if person %}
{%- if inline and person.e-mail -%}
{{ li }} <a href="mailto:{{person.e-mail}}">{{person.name}}</a> {{ eli }}
{%- elsif person.website -%}
{{ li }} <a href="{{person.website}}">{{ person.name }}</a> {{ eli }}
{% else %}
{{ li }} {{person.name}} {{ eli }}
{% endif %}
{% elsif contact contains "@" %}
<a href="mailto:{{contact}}"> <em>{{contact}}</em> </a>
{% assign written = true %}
{% else %}
{% for person_hash in site.data.people -%}
{% assign person = person_hash[1] -%}
{% if person.shortname == contact %}
{%- if inline and person.e-mail -%}
{{ li }} <a href="mailto:{{person.e-mail}}">{{person.name}}</a> {{ eli }}
{% assign written = true %}
{%- elsif person.website -%}
{{ li }} <a href="{{person.website}}">{{ person.name }}</a> {{ eli }}
{% assign written = true %}
{% else %}
{{ li }} {{person.name}} {{ eli }}
{% assign written = true %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% unless written %}
{{ else }}
{{ li }} {{ contact | markdownify | remove: '<p>' | remove: '</p>' }} {{ eli }}
{% endunless %}
{% endif %}
{% endfor %}

{%- unless include.inline %}
Expand Down
20 changes: 20 additions & 0 deletions _layouts/focus-area.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
{% assign page_focus_area = page.name | basename %}
{% assign sorted = site.pages | smart_page_sort: "focus-area", page_focus_area %}

{% assign fa_team = sorted | get_set: "team" | sort | key_to_value: site.data.people %}

{% unless fa_team.empty %}
<div class="container-fluid">
<div class="row">
{% for person in fa_team %}
<div class="card" style="font-size:10px;width: 87px;height: 135px;margin-bottom:-15px;">
<img style="width: 85px;height: 85px; object-fit:cover;" src="{{person.photo}}" alt="Card image cap">
{%- if person.website -%}
<a href="{{person.website}}">{{ person.name }}</a>
{%- else -%}
{{ person.name }}
{%- endif -%}
</div>
{% endfor %}
</div>
<br>
</div>
{% endunless %}

{% unless sorted.empty %}
<div class="container-fluid projects">
<h2 class="alt-h2 text-center mb-3 mt-lg-6" id="projects">{{ page.short_title | upcase }} Projects</h2><br>
Expand Down
8 changes: 8 additions & 0 deletions _plugins/smart_sort.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ def smart_page_sort(input, field, match)
input.select { |p| p['pagetype'] == 'project' && p[field].include?(match) }
.sort_by { |p| [p['position'] || 0, p['title'].downcase] }
end

def get_set(input, key)
input.flat_map { |p| p[key] || [] }.uniq
end

def key_to_value(input, hash)
input.map { |k| hash.fetch(k, nil) }.compact
end
end
end

Expand Down