mirror of
https://github.com/matrix-org/matrix.org.git
synced 2026-01-16 23:13:50 +00:00
Sort foundation members alphabetically in display (#2763)
* Sort foundation members alphabetically in display * Refactor supporters section to use macro with case-insensitive sorting
This commit is contained in:
parent
60652c08b8
commit
75fb2d476b
2 changed files with 31 additions and 30 deletions
25
templates/macros/supporters.html
Normal file
25
templates/macros/supporters.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% macro case_insensitive_sort_supporters(supporters) %}
|
||||
{# Step 1: Extract all supporter names in lower case #}
|
||||
{% set lower_names = [] %}
|
||||
{% for supporter in supporters %}
|
||||
{% set_global lower_names = lower_names | concat(with=[supporter.name | lower]) %}
|
||||
{% endfor %}
|
||||
|
||||
{# Step 2: Sort lower-case names #}
|
||||
{% set sorted_lower_names = lower_names | sort %}
|
||||
|
||||
{# Step 3: Re-match sorted names with original supporter objects #}
|
||||
{% for lower_name in sorted_lower_names %}
|
||||
{% for supporter in supporters %}
|
||||
{% if supporter.name | lower == lower_name %}
|
||||
{% set_global current_supporter = supporter %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<a href="{{ current_supporter.website }}" target="_blank" class="supporters-card">
|
||||
<img src="/support/{{ current_supporter.logo }}" alt="{{ current_supporter.name }}'s logo">
|
||||
<span>{{ current_supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{% extends "section.html" %}
|
||||
{% import "macros/banner.html" as banner %}
|
||||
{% import "macros/supporters.html" as supporters_macros %}
|
||||
{% block head_extra %}
|
||||
<meta name="description" content="{{ section.extra.summary }}">
|
||||
{% endblock head_extra %}
|
||||
|
|
@ -37,56 +38,31 @@
|
|||
<div class="supporters-section" id="platinum-supporters">
|
||||
<h2>Platinum Members</h2>
|
||||
<div class="cards">
|
||||
{% for supporter in supporters.platinum %}
|
||||
<a href="{{ supporter.website }}" target="_blank" class="supporters-card">
|
||||
<img src="/support/{{ supporter.logo }}" alt="{{ supporter.name }}'s logo">
|
||||
<span>{{ supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{{ supporters_macros::case_insensitive_sort_supporters(supporters=supporters.platinum) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="supporters-section" id="gold-supporters">
|
||||
<h2>Gold Members</h2>
|
||||
<div class="cards">
|
||||
{% for supporter in supporters.gold %}
|
||||
<a href="{{ supporter.website }}" target="_blank" class="supporters-card">
|
||||
<img src="/support/{{ supporter.logo }}" alt="{{ supporter.name }}'s logo">
|
||||
<span>{{ supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{{ supporters_macros::case_insensitive_sort_supporters(supporters=supporters.gold) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="supporters-section" id="silver-supporters">
|
||||
<h2>Silver Members</h2>
|
||||
<div class="cards">
|
||||
{% for supporter in supporters.silver %}
|
||||
<a href="{{ supporter.website }}" target="_blank" class="supporters-card">
|
||||
<img src="/support/{{ supporter.logo }}" alt="{{ supporter.name }}'s logo">
|
||||
<span>{{ supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{{ supporters_macros::case_insensitive_sort_supporters(supporters=supporters.silver) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="supporters-section" id="ecosystem-supporters">
|
||||
<h2>Ecosystem Members</h2>
|
||||
<div class="cards">
|
||||
{% for supporter in supporters.ecosystem %}
|
||||
<a href="{{ supporter.website }}" target="_blank" class="supporters-card">
|
||||
<img src="/support/{{ supporter.logo }}" alt="{{ supporter.name }}'s logo">
|
||||
<span>{{ supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{{ supporters_macros::case_insensitive_sort_supporters(supporters=supporters.ecosystem) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="supporters-section" id="associate-supporters">
|
||||
<h2>Associate Members</h2>
|
||||
<div class="cards">
|
||||
{% for supporter in supporters.associate %}
|
||||
<a href="{{ supporter.website }}" class="supporters-card">
|
||||
<img src="/support/{{ supporter.logo }}" alt="{{ supporter.name }}'s logo">
|
||||
<span>{{ supporter.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{{ supporters_macros::case_insensitive_sort_supporters(supporters=supporters.associate) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue