Show country names and flags on accommodation page

This commit is contained in:
Edward Betts 2024-01-03 11:33:24 +00:00
parent 9800030201
commit fd46f0a405
2 changed files with 19 additions and 2 deletions

View file

@ -1,9 +1,10 @@
{% extends "base.html" %}
{% block style %}
{% set column_count = 7 %}
<style>
.grid-container {
display: grid;
grid-template-columns: repeat(6, auto);
grid-template-columns: repeat({{ column_count }}, auto);
gap: 10px;
justify-content: start;
}
@ -13,18 +14,28 @@
}
.heading {
grid-column: 1 / 7; /* Spans from the 1st line to the 7th line */
grid-column: 1 / {{ column_count + 1 }}; /* Spans from the 1st line to the 7th line */
}
</style>
{% endblock %}
{% macro row(item, badge) %}
{% set country = get_country(item.country) %}
<div class="grid-item text-end">{{ item.from.strftime("%a, %d %b %Y") }}</div>
<div class="grid-item text-end">{{ item.to.strftime("%a, %d %b") }}</div>
<div class="grid-item text-end">{{ (item.to.date() - item.from.date()).days }}</div>
<div class="grid-item">{{ item.name }}</div>
<div class="grid-item">{{ item.operator }}</div>
<div class="grid-item">{{ item.location }}</div>
<div class="grid-item">
{% if country %}
{{ country.flag }} {{ country.name }}
{% else %}
<span class="text-bg-danger p-2">
country code <strong>{{ item.country }}</strong> not found
</span>
{% endif %}
</div>
{% endmacro %}
{% macro section(heading, item_list, badge) %}