Unverified Commit 1b05b8bd authored by Roland Denis's avatar Roland Denis
Browse files

Separates rendering methods for cards depending on the article category.

parent f38892bb
{% macro job_offer(article) %}
<div class="card col-md-4 pb-4 pt-3 px-xl-5 px-md-3 align-self-end">
<a href="{{ SITEURL }}/{{ article.url }}">
<div class="card-header">
{{ article.title }}
</div>
<div class="card-body p-0 d-flex align-items-center">
<span class="pr-2 border-right">
{{ article.job_type }}
{% if article.job_duration %}
, {{ article.job_duration }}
{% endif %}
</span>
</div>
<div class="card-footer p-0 d-flex align-items-center">
{{ article.job_location }}
</div>
</a>
</div>
{% endmacro %}
{% macro default(article) %}
<div class="card col-md-4 pb-4 pt-3 px-xl-5 px-md-3 align-self-end">
<a href="{{ SITEURL }}/{{ article.url }}">
<div class="card-header">
{{ article.title }}
</div>
<div class="card-body p-0 d-flex align-items-center">
<span class="pr-2 border-right">{{ article.date_event }}</span>
<div class="mx-2" id="circle-{{article.category}}"></div>
<span class="category text-uppercase"> {{CIRCLES[article.category]}} </span>
</div>
<div class="card-footer p-0 d-flex align-items-center">
{{ article.lieu }}
</div>
</a>
</div>
{% endmacro %}
{% macro dispatch(article) %}
{% if article.category == "Offres d'emploi" %}
{{ job_offer(article) }}
{% else %}
{{ default(article) }}
{% endif %}
{% endmacro %}
......@@ -76,47 +76,13 @@
{% block content %}
<div class="container-fluid event">
<div class="row d-flex justify-content-center mx-xl-5 mx-lg-3" id="event" style="margin-top: 22px;">
{% if category == "Offres d'emploi" %}
{% for article in articles_page.object_list %}
<div class="card col-md-4 pb-4 pt-3 px-xl-5 px-md-3 align-self-end">
<a href="{{ SITEURL }}/{{ article.url }}">
<div class="card-header">
{{ article.title }}
</div>
<div class="card-body p-0 d-flex align-items-center">
<span class="pr-2 border-right">
{{ article.job_type }}
{% if article.job_duration %}
, {{ article.job_duration }}
{% endif %}
</span>
</div>
<div class="card-footer p-0 d-flex align-items-center">
{{ article.job_location }}
</div>
</a>
</div>
{% endfor %}
{% import 'cards.html' as cards with context %}
{% for article in articles_page.object_list %}
{{ cards.dispatch(article) }}
{% endfor %}
{% else %}
{% for article in articles_page.object_list %}
<div class="card col-md-4 pb-4 pt-3 px-xl-5 px-md-3 align-self-end">
<a href="{{ SITEURL }}/{{ article.url }}">
<div class="card-header">
{{ article.title }}
</div>
<div class="card-body p-0 d-flex align-items-center">
<span class="pr-2 border-right">{{ article.date_event }}</span>
<div class="mx-2" id="circle-{{article.category}}"></div>
<span class="category text-uppercase"> {{CIRCLES[article.category]}} </span>
</div>
<div class="card-footer p-0 d-flex align-items-center">
{{ article.lieu }}
</div>
</a>
</div>
{% endfor %}
{% if category != "Offres d'emploi" %}
<div class="card col-md-4 pt-3 pb-4 px-xl-5 px-md-3 align-self-end">
<div class="card-header"></div>
<div class="card-footer p-0 d-flex align-items-center" id="special">
......
......@@ -110,23 +110,11 @@
</a>
</div> -->
{% for article in articles_page.object_list[:5] %}
<div class="card col-md-4 pb-4 pt-3 px-xl-5 px-md-3 align-self-end">
<a href="{{ SITEURL }}/{{ article.url }}">
<div class="card-header">
{{ article.title }}
</div>
<div class="card-body p-0 d-flex align-items-center">
<span class="pr-2 border-right">{{ article.date_event }}</span>
<div class="mx-2" id="circle-{{article.category}}"></div>
<span class="category text-uppercase"> {{CIRCLES[article.category]}} </span>
</div>
<div class="card-footer p-0 d-flex align-items-center">
{{ article.lieu }}
</div>
</a>
</div>
{% import 'cards.html' as cards with context %}
{% for article in articles_page.object_list %}
{{ cards.dispatch(article) }}
{% endfor %}
<div class="card col-md-4 pt-3 pb-4 px-xl-5 px-md-3 align-self-end">
<div class="card-header"></div>
<div class="card-footer p-0 d-flex align-items-center" id="special">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment