Skip to content

Commit

Permalink
Extract party list into partial template
Browse files Browse the repository at this point in the history
  • Loading branch information
homeworkprod committed Apr 22, 2024
1 parent be5f27d commit cc786dc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
28 changes: 28 additions & 0 deletions src/lanpartydb_website/blueprints/party/templates/party/_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<table class="table--index table--wide">
<thead>
<tr>
<th>{{ _('Title') }}</th>
<th></th>
<th>{{ _('Start') }}</th>
<th>{{ _('End') }}</th>
<th class="number">{{ _('Seats') }}</th>
</tr>
</thead>
<tbody>
{%- for party in parties %}
<tr>
<td><a href="{{ url_for('.view', slug=party.slug) }}">{{ party.title }}</a></td>
<td class="centered">
{%- if party.location %}
{%- with country = countries.get(alpha_2=party.location.country_code) %}
<span title="{{ country.name }}">{{ country.flag }}</span>
{%- endwith %}
{%- endif %}
</td>
<td class="nowrap">{{ party.start_on|dateformat }}</td>
<td class="nowrap">{{ party.end_on|dateformat }}</td>
<td class="number">{{ party.seats }}</td>
</tr>
{%- endfor %}
</tbody>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,7 @@ <h1>Parties <small>{{ pagination.total }}</small></h1>
{{ pagination.links }}
</div>

<table class="table--index table--wide">
<thead>
<tr>
<th>{{ _('Title') }}</th>
<th></th>
<th>{{ _('Start') }}</th>
<th>{{ _('End') }}</th>
<th class="number">{{ _('Seats') }}</th>
</tr>
</thead>
<tbody>
{%- for party in parties %}
<tr>
<td><a href="{{ url_for('.view', slug=party.slug) }}">{{ party.title }}</a></td>
<td class="centered">
{%- if party.location %}
{%- with country = countries.get(alpha_2=party.location.country_code) %}
<span title="{{ country.name }}">{{ country.flag }}</span>
{%- endwith %}
{%- endif %}
</td>
<td class="nowrap">{{ party.start_on|dateformat }}</td>
<td class="nowrap">{{ party.end_on|dateformat }}</td>
<td class="number">{{ party.seats }}</td>
</tr>
{%- endfor %}
</tbody>
</table>
{% include 'party/_list.html' %}

<div class="block text--centered">
{{ pagination.info }}
Expand Down

0 comments on commit cc786dc

Please sign in to comment.