Skip to content

Commit

Permalink
Improve templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Jul 16, 2024
1 parent cea9925 commit 1a9258d
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 91 deletions.
20 changes: 15 additions & 5 deletions events/templates/events/blocks/events_index_posts_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@
<h2 class="fr-card__title">
<a href="{{ post.url }}">{{ post.title }}</a>
</h2>
<p class="fr-card__desc">Publié le {{ post.date |date:'l j F Y' }}</p>
{% if post.blog_categories.all %}
<p class="fr-card__desc fr-icon-calendar-event-fill">
{% if post.event_date_start.date == post.event_date_end.date %}
{{ post.event_date_start.date }}
{% elif post.event_date_start.year == post.event_date_end.year and post.event_date_start.month == post.event_date_end.month %}
{{ post.event_date_start.day }} – {{ post.event_date_end.date }}
{% elif post.event_date_start.year == post.event_date_end.year %}
{{ post.event_date_start|date:"j F" }} – {{ post.event_date_end|date:"j F Y" }}
{% else %}
{{ post.event_date_start.date }} – {{ post.event_date_end.date }}
{% endif %}
</p>
{% if post.event_categories.all %}
<div class="fr-card__start">
<ul class="fr-tags-group">
{% for cat in post.blog_categories.all %}
{% for cat in post.event_categories.all %}
<li>
<p class="fr-tag">{{ cat.name }}</p>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% if post.header_image %}
Expand Down
165 changes: 79 additions & 86 deletions events/templates/events/events_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,98 +60,91 @@ <h1>
{{ page.body }}
{% endif %}

{% if page.show_filters %}
<div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">
<div class="fr-col fr-col-md-4 fr-col-12">
<nav class="fr-sidemenu fr-sidemenu--sticky-full-height fr-mb-0-5v">
<div class="fr-sidemenu__inner">
<button class="fr-sidemenu__btn"
hidden
aria-controls="fr-sidemenu-wrapper"
aria-expanded="false">{% translate "Filters" %}</button>
<div class="fr-collapse" id="fr-sidemenu-wrapper">
<div class="fr-sidemenu__title" id="fr-sidemenu-title">{% translate "Filters" %}</div>
{% if categories and page.filter_by_category %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by category" %}</h2>
<ul class="fr-tags-group">
{% for category in categories %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter category=category %}"
{% if category.slug == current_category.slug %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>
{{ category.name }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">
<div class="fr-col fr-col-md-4 fr-col-12">
<nav class="fr-sidemenu fr-sidemenu--sticky-full-height fr-mb-0-5v">
<div class="fr-sidemenu__inner">
<button class="fr-sidemenu__btn"
hidden
aria-controls="fr-sidemenu-wrapper"
aria-expanded="false">{% translate "Filters" %}</button>
<div class="fr-collapse" id="fr-sidemenu-wrapper">
<div class="fr-sidemenu__title" id="fr-sidemenu-title">{% translate "Filters" %}</div>
{% if categories and page.filter_by_category %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by category" %}</h2>
<ul class="fr-tags-group">
{% for category in categories %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter category=category %}"
{% if category.slug == current_category.slug %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>
{{ category.name }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

{% if tags and page.filter_by_tag %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by tag" %}</h2>
<ul class="fr-tags-group">
{% for tag in tags %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter tag=tag %}"
{% if tag.id == current_tag.id %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>
{{ tag }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if tags and page.filter_by_tag %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by tag" %}</h2>
<ul class="fr-tags-group">
{% for tag in tags %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter tag=tag %}"
{% if tag.id == current_tag.id %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>
{{ tag }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

{% if authors and page.filter_by_author %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by author" %}</h2>
<ul class="fr-tags-group">
{% for author in authors %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter author=author %}"
{% if author == current_author %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>{{ author.name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if authors and page.filter_by_author %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by author" %}</h2>
<ul class="fr-tags-group">
{% for author in authors %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter author=author %}"
{% if author == current_author %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>{{ author.name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

{% if sources and page.filter_by_source %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by source" %}</h2>
<ul class="fr-tags-group">
{% for source in sources %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter source=source %}"
{% if source == current_source %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>{{ source.name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
{% if sources and page.filter_by_source %}
<div class="fr-my-3w">
<h2 class="fr-h6">{% translate "Filter by source" %}</h2>
<ul class="fr-tags-group">
{% for source in sources %}
<li>
<a class="fr-tag"
href="{% pageurl page %}{% toggle_url_filter source=source %}"
{% if source == current_source %}aria-pressed="true"{% else %}aria-pressed="false"{% endif %}>{{ source.name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</nav>
</div>
</div>
</nav>
</div>

<div class="fr-col fr-col-md-8 fr-col-12">
<div class="fr-grid-row fr-grid-row--gutters">{% include "events/blocks/events_index_posts_list.html" %}</div>
{% if posts.paginator.num_pages > 1 %}
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
</div>
<div class="fr-col fr-col-md-8 fr-col-12">
<div class="fr-grid-row fr-grid-row--gutters">{% include "events/blocks/events_index_posts_list.html" %}</div>
{% if posts.paginator.num_pages > 1 %}
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
</div>
{% else %}
<div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">{% include "events/blocks/events_index_posts_list.html" %}</div>
{% if posts.paginator.num_pages > 1 %}
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
{% endif %}
</div>
</div>

{% endblock content %}

0 comments on commit 1a9258d

Please sign in to comment.