Add filters for space launches

This commit is contained in:
Edward Betts 2024-07-01 22:27:19 +03:00
parent c41bcc3304
commit b65d79cb63
3 changed files with 66 additions and 6 deletions

View file

@ -6,7 +6,40 @@
<div class="container-fluid mt-2">
<h1>Space launches</h1>
{% for launch in rockets %}
<h4>Filters</h4>
<p>Mission type:
{% if request.args.type %}<a href="{{ request.path }}">🗙</a>{% endif %}
{% for t in mission_types | sort %}
{% if t == request.args.type %}
<strong>{{ t }}</strong>
{% else %}
<a href="?type={{ t }}" class="text-nowrap">
{{ t }}
</a>
{% endif %}
{% if not loop.last %} | {% endif %}
{% endfor %}
</p>
<p>Vehicle:
{% if request.args.rocket %}<a href="{{ request.path }}">🗙</a>{% endif %}
{% for r in rockets | sort %}
{% if r == request.args.rockets %}
<strong>{{ r }}</strong>
{% else %}
<a href="?rocket={{ r }}" class="text-nowrap">
{{ r }}
</a>
{% endif %}
{% if not loop.last %} | {% endif %}
{% endfor %}
</p>
{% for launch in launches %}
{% set highlight =" bg-primary-subtle" if launch.slug in config.FOLLOW_LAUNCHES else "" %}
{% set country = get_country(launch.country_code) %}
<div class="row{{highlight}}">
@ -24,7 +57,7 @@
<div class="col">
<div>
{{ country.flag }}
{{ launch.rocket }}
{{ launch.rocket.full_name }}
&ndash;
<strong>{{launch.mission.name }}</strong>
&ndash;