Skip to content

Commit 69818f2

Browse files
HarHarLinksweeman1337
authored andcommitted
deduplicate macros
Signed-off-by: HarHarLinks <2803622+HarHarLinks@users.noreply.github.com>
1 parent ff4224a commit 69818f2

2 files changed

Lines changed: 26 additions & 49 deletions

File tree

templates/governing-board/elections.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ <h3 id="individual-nominees">Individual Members (Max. {{ seats }} Seat{{ seats |
4040
<div class="nominees-buttons-row">
4141
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
4242
</div>
43-
{% for individual in nominees.individual_members %}
44-
{{ nominee::individual(individual=individual) }}
43+
{% for candidate in nominees.individual_members %}
44+
{{ nominee::candidate(candidate=candidate) }}
4545
{% endfor %}
4646
</div>
4747
{% endif %}
@@ -54,8 +54,8 @@ <h3 id="ecosystem-nominees">Ecosystem Members (Max. {{ seats }} Seat{{ seats | p
5454
<div class="nominees-buttons-row">
5555
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
5656
</div>
57-
{% for representative in nominees.ecosystem_members %}
58-
{{ nominee::project(representative=representative) }}
57+
{% for candidate in nominees.ecosystem_members %}
58+
{{ nominee::candidate(candidate=candidate) }}
5959
{% endfor %}
6060
</div>
6161
{% endif %}
@@ -67,8 +67,8 @@ <h3 id="associate-nominees">Associate Members (Max. {{ seats }} Seat{{ seats | p
6767
<div class="nominees-buttons-row">
6868
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
6969
</div>
70-
{% for representative in nominees.associate_members %}
71-
{{ nominee::project(representative=representative) }}
70+
{% for candidate in nominees.associate_members %}
71+
{{ nominee::candidate(candidate=candidate) }}
7272
{% endfor %}
7373
</div>
7474
{% endif %}
@@ -80,8 +80,8 @@ <h3 id="platinum-nominees">Platinum Members (Max. {{ seats }} Seat{{ seats | plu
8080
<div class="nominees-buttons-row">
8181
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
8282
</div>
83-
{% for representative in nominees.platinum_members %}
84-
{{ nominee::project(representative=representative) }}
83+
{% for candidate in nominees.platinum_members %}
84+
{{ nominee::candidate(candidate=candidate) }}
8585
{% endfor %}
8686
</div>
8787
{% endif %}
@@ -93,8 +93,8 @@ <h3 id="gold-nominees">Gold Members (Max. {{ seats }} Seat{{ seats | pluralize }
9393
<div class="nominees-buttons-row">
9494
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
9595
</div>
96-
{% for representative in nominees.gold_members %}
97-
{{ nominee::project(representative=representative) }}
96+
{% for candidate in nominees.gold_members %}
97+
{{ nominee::candidate(candidate=candidate) }}
9898
{% endfor %}
9999
</div>
100100
{% endif %}
@@ -106,8 +106,8 @@ <h3 id="silver-nominees">Silver Members (Max. {{ seats }} Seat{{ seats | plurali
106106
<div class="nominees-buttons-row">
107107
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
108108
</div>
109-
{% for representative in nominees.silver_members %}
110-
{{ nominee::project(representative=representative) }}
109+
{% for candidate in nominees.silver_members %}
110+
{{ nominee::candidate(candidate=candidate) }}
111111
{% endfor %}
112112
</div>
113113
{% endif %}
@@ -119,8 +119,8 @@ <h3 id="guardian-nominees">Guardians (Max. {{ seats }} Seat{{ seats | pluralize
119119
<div class="nominees-buttons-row">
120120
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
121121
</div>
122-
{% for guardian in nominees.guardians %}
123-
{{ nominee::individual(individual=guardian) }}
122+
{% for candidate in nominees.guardians %}
123+
{{ nominee::candidate(candidate=candidate) }}
124124
{% endfor %}
125125
</div>
126126
{% endif %}
@@ -130,12 +130,10 @@ <h3 id="guardian-nominees">Guardians (Max. {{ seats }} Seat{{ seats | pluralize
130130
<h3 id="sct-nominees">Spec Core Team Members (Max. {{ seats }} Seat{{ seats | pluralize }})</h3>
131131
<div class="nominees">
132132
<div class="nominees-buttons-row">
133-
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">
134-
Collapse all
135-
</button>
133+
<button class="expand-all">Expand all</button> &ndash; <button class="collapse-all">Collapse all</button>
136134
</div>
137-
{% for individual in nominees.sct_members %}
138-
{{ nominee::individual(individual=individual) }}
135+
{% for candidate in nominees.sct_members %}
136+
{{ nominee::candidate(candidate=candidate) }}
139137
{% endfor %}
140138
</div>
141139
{% endif %}

templates/macros/nominee.html

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,18 @@
1-
{% macro individual(individual) %}
1+
{% macro candidate(candidate) %}
22
<details class="nominee">
3-
<summary>{{ individual.name }} {% if individual.pronouns %}({{ individual.pronouns }}){% endif %}</summary>
3+
<summary>{{ candidate.name }} {% if candidate.pronouns %}({{ candidate.pronouns }}){% endif %}{% if candidate.project %} - {{
4+
candidate.project }}{% endif %}</summary>
45
<h4>Biography</h4>
5-
{% if individual.bio %}
6-
{{ individual.bio | markdown() | safe }}
6+
{% if candidate.bio %}
7+
{{ candidate.bio | markdown() | safe }}
78
{% else %}
89
<p>(The candidate submitted no biography.)</p>
910
{% endif %}
1011
<h4>Platform Statement</h4>
11-
{% if individual.platform_statement %}
12-
{{ individual.platform_statement | markdown() | safe }}
13-
{% if individual.extended_platform %}
14-
<p><a href="{{ individual.extended_platform | safe }}" target="_blank">Read this candidate's extended platform.</a></p>
15-
{% endif %}
16-
{% else %}
17-
<p>(The candidate submitted no platform statement.)</p>
18-
{% endif %}
19-
</details>
20-
{% endmacro %}
21-
22-
{% macro project(representative) %}
23-
<details class="nominee">
24-
<summary>{{ representative.name }} {% if representative.pronouns %}({{ representative.pronouns }}){% endif %} - {{
25-
representative.project }}</summary>
26-
<h4>Biography</h4>
27-
{% if representative.bio %}
28-
{{ representative.bio | markdown() | safe }}
29-
{% else %}
30-
<p>(The candidate submitted no biography.)</p>
31-
{% endif %}
32-
<h4>Platform Statement</h4>
33-
{% if representative.platform_statement %}
34-
{{ representative.platform_statement | markdown() | safe }}
35-
{% if representative.extended_platform %}
36-
<p><a href="{{ representative.extended_platform | safe }}" target="_blank">Read this candidate's extended platform.</a></p>
12+
{% if candidate.platform_statement %}
13+
{{ candidate.platform_statement | markdown() | safe }}
14+
{% if candidate.extended_platform %}
15+
<p><a href="{{ candidate.extended_platform | safe }}" target="_blank">Read this candidate's extended platform.</a></p>
3716
{% endif %}
3817
{% else %}
3918
<p>(The candidate submitted no platform statement.)</p>

0 commit comments

Comments
 (0)