Skip to content

Commit

Permalink
highlight leadership & unify image size (#297)
Browse files Browse the repository at this point in the history
* highlight leadership & unify image size

* prep translations

* add alumni text

* fix preview build to show images correctly

* add notification about build fail

* add notification about build fail
  • Loading branch information
drmowinckels authored Feb 14, 2024
1 parent 15c48ef commit 06c0f81
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 39 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
hugo \
-e development \
-d ${{ env.hugobd }} \
-b https://${{ env.netalias }}-rladies-dev.netlify.app/
-b https://${{ env.netalias }}--rladies-dev.netlify.app/
- name: Deploy Preview
Expand All @@ -161,9 +161,21 @@ jobs:
netlify deploy \
--alias ${{ env.netalias }} \
--dir=${{ env.hugobd }}
- uses: actions/github-script@v6
name: "Notify about build failure"
if: ${{ failure() }}
with:
github-token: ${{ env.token }}
script: |
await github.rest.issues.createComment({
issue_number: ${{ env.issue }},
owner: 'rladies',
repo: '${{ env.repo_name }}',
body: 'Test build failed :sob: [Check out the build logs](https://github.com/rladies/rladies.github.io/actions/runs/${{ github.run_id }}).
})
- uses: actions/github-script@v6
if: ${{ (env.on_fork != true) && (github.event_name == 'workflow_dispatch' ) }}
name: "Notify about build preview"
with:
github-token: ${{ env.token }}
Expand All @@ -172,23 +184,9 @@ jobs:
issue_number: ${{ env.issue }},
owner: 'rladies',
repo: '${{ env.repo_name }}',
body: ':tada: The preview is built! [Check it out :eyes:](https://${{ env.netalias }}-rladies-dev.netlify.app)'
body: ':tada: The preview is built! [Check it out :eyes:](https://${{ env.netalias }}--rladies-dev.netlify.app)'
})
notify:
runs-on: ubuntu-latest
if: ${{ failure() && (github.event_name == 'workflow_dispatch' ) }}
steps:
- name: Set env parameters
run: |


- name: Create repository dispatch event
env:
GITHUB_TOKEN: ${{ secrets.GLOBAL_GHA_PAT }}
run: |
gh api repos/${{ env.repo_name }}/dispatches \
--input type=pr \
--input pr_number=${{ env.issue }} \
--input status=failed \
--input conclusion=${{ github.event.workflow_run.conclusion }}

9 changes: 9 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ city: "City"
cities: "Cities"
event: "Event"

# About Global Team ----
leadership: 'Leadership'
global-team: 'Global Team'
alumni: 'Alumni'
alumni-text: |
R-Ladies is extremely thankful for all the hard work
and dedication of our past members and leaders.
We would not be where we are today without them.
# Other ----
social_media: "Social media"
archive: 'Archive'
Expand Down
74 changes: 55 additions & 19 deletions themes/hugo-rladies/layouts/global-team/single.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,68 @@

{{ define "main" }}
<p>{{ .Content }}</p>
{{ $gt := $.Site.Data.global_team }}
<!-- create maps of names for gt_roles, becasue we cannot 'where' over maps of maps -->
{{ $.Scratch.Set "gt_roles" (slice) }}
{{ range $gt.current }}
{{ $.Scratch.Add "gt_roles" .role }}
{{ end }}
{{ $.Scratch.Set "gt_roles" ($.Scratch.Get "gt_roles" | uniq | sort) }}

<!-- create maps of names for gt_roles, becasue we cannot where over maps of maps -->
{{ $.Scratch.Set "leadership" (slice) }}

<!-- Create maps of members in various roles -->
{{ range $r_index, $r_name := ($.Scratch.Get "gt_roles" ) }}
{{ $.Scratch.Set $r_name (slice) }}
{{ range $idx, $value := $gt.current }}
{{ $sect := intersect $value.role (slice $r_name) }}
{{ if eq (len $sect) 1 }}
{{ $.Scratch.Add $r_name .name }}
{{ if eq $r_name "Leadership" }}
{{ $.Scratch.Add "leadership" $idx }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

<!-- to emable shuffle of the grid -->
{{ $.Scratch.Set "gtc" (slice) }}
{{ range $name, $_ := $gt.current }}
{{ $.Scratch.Add "gtc" $name }}
{{ end }}

{{ $path := $.Site.GetPage "section" "global-team" }}

<p>{{ .Content }}</p>

<div class="container expand-grid" id="leadership-team">
<h1 class="section-title">{{ i18n "leadership" }}</h1>
<ul class="justify-content-center row row-xl-2 row-lg-3 row-md-4 row-sm-6 row-9 full-width" id="global-team">

{{ range $name := $.Scratch.Get "leadership" | shuffle }}
{{ $d := index $gt.current $name }}
{{ $img := ( printf "about-us/global-team/img/%s" $d.img.url ) }}
{{ $.Scratch.Set "img" "" }}
{{ with $path.Resources.GetMatch ( printf "img/%s*" $name ) }}
{{ $image := . }}
{{ $image := $image.Fill "200x200" }}
{{ $.Scratch.Set "img" $image.RelPermalink }}
{{ end }}
{{ $image := $.Scratch.Get "img" }}

{{ $data := newScratch }}
{{ $data.Set "foot" "" }}
{{ with $d.img.credit }}
{{ $data.Set "foot" "<p class=\"card-text text-muted\"><small>" }}
{{ $data.Add "foot" (printf "Photo credit: %s" . ) }}
{{ $data.Add "foot" "</small></p>" }}
{{ end }}

{{ partial "funcs/card-expand.html" (dict "title" $d.name "img" $image "size" "small" "descr" ($data.Get "foot")) }}
{{ end }}
</ul>
</div>

<h1 class="section-title">{{ i18n "global-team" }}</h1>
<div class="my-5">
<table class="table table-sm ">
<thead>
Expand All @@ -29,7 +73,6 @@
</thead>
<tbody>


{{ range ($.Scratch.Get "gt_roles" ) | shuffle }}
<tr class="mt-4">
<td class="text-right b-rladies-r" rowspan="{{ ($.Scratch.Get .) | len }}">
Expand All @@ -41,29 +84,21 @@
{{ . }}
</td>
</tr>
{{ end }}
{{ end }}
{{ end }}
</tbody>
</table>

<div class="container expand-grid" id="global-team">
<ul class="justify-content-center row row-xl-2 row-lg-3 row-md-4 row-sm-6 row-9 full-width" id="global-team">
<!-- shuffle the grid -->
{{ $.Scratch.Set "gtc" (slice) }}
{{ range $name, $_ := $gt.current }}
{{ $.Scratch.Add "gtc" $name }}
{{ end }}

{{ $path := $.Site.GetPage "section" "global-team" }}

<ul class="justify-content-center row row-xl-2 row-lg-3 row-md-4 row-sm-6 row-9 full-width" id="global-team">
{{ range $name := $.Scratch.Get "gtc" | shuffle }}
{{ $d := index $gt.current $name }}
{{ $descr := delimit $d.role ", " }}
{{ $img := ( printf "about-us/global-team/img/%s" $d.img.url ) }}
{{ $.Scratch.Set "img" "" }}
{{ with $path.Resources.GetMatch ( printf "img/%s*" $name ) }}
{{ $image := . }}
{{ $image := $image.Fit "200x200" }}
{{ $image := $image.Fill "200x200" }}
{{ $.Scratch.Set "img" $image.RelPermalink }}
{{ end }}
{{ $image := $.Scratch.Get "img" }}
Expand All @@ -81,9 +116,10 @@
</ul>
</div>
</div>

<hr>
<div class="my-5">
<h1 class="section-title">Alumni</h1>
<h1 class="section-title">{{ i18n "alumni" }}</h1>
<p>{{ i18n "alumni-text" }}</p>
<div class="container expand-grid">
<ul class="justify-content-center row row-xl-2 row-lg-3 row-md-4 row-sm-6 row-9 full-width" id="global-team-alumni">
<!-- shuffle the grid -->
Expand All @@ -98,13 +134,13 @@ <h1 class="section-title">Alumni</h1>
{{ $.Scratch.Set "img" "" }}
{{ with $path.Resources.GetMatch ( printf "img/%s*" $name ) }}
{{ $image := . }}
{{ $image := $image.Fit "200x200" }}
{{ $image := $image.Fill "200x200" }}
{{ $.Scratch.Set "img" $image.RelPermalink }}
{{ end }}
{{ $image := $.Scratch.Get "img" }}

{{ $foot := (printf "%s &#8212 %s" $d.start $d.end)}}
{{ partial "funcs/card-expand.html" (dict "title" $d.name "img" $image "descr" $descr "size" "small" "foot" $foot) }}
{{ partial "funcs/card-expand.html" (dict "title" $d.name "img" $image "descr" $foot "size" "small" "foot" $descr) }}
{{ end }}

</div>
Expand Down

0 comments on commit 06c0f81

Please sign in to comment.