Ajout de category et article + nouveau css

This commit is contained in:
Rick 2021-01-28 22:17:05 +01:00
parent fa12c369f4
commit 5433d20545
Signed by: Rick
GPG Key ID: 9570A7DB7CB2F436
3 changed files with 53 additions and 0 deletions

22
templates/article.html Normal file
View File

@ -0,0 +1,22 @@
{% extends "base.html" %}
{% block content %}
<div id="article">
<div id="article-header">
<p class="infos-art">Par
{% for author in article.authors %}
<a href="{{ SITEURL }}/{{ author.url }}" class="author">{{ author }}</a>
{% endfor %}
dans <a href="{{ SITEURL }}/{{ article.category.url }}" class="category">{{ article.category }}</a> le {{ article.date.strftime('%d/%m/%Y') }}.
</p>
<br />
<h1>{{ article.title }}</h1>
{% if article.subtitle %}
<h2>{{ article.subtitle }}</h2>
{% endif %}
</div>
<div id="article-content">
{{ article.content }}
</div>
</div>
{% endblock content %}

11
templates/category.html Normal file
View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% import "macros.html" as macro %}
{% block content %}
<div id="cat-header">
<h1>{{ category.name }}</h1>
<hr />
</div>
{{ macro.listArticles(articles_page.object_list) }}
{% endblock content %}

20
templates/macros.html Normal file
View File

@ -0,0 +1,20 @@
{% macro listArticles(objIt) -%}
{% for art in objIt %}
<div class="pre-art">
<p class="infos-art">Par
{% for author in art.authors %}
<a href="{{ SITEURL }}/{{ author.url }}" class="author">{{ author }}</a>
{% endfor %}
dans <a href="{{ SITEURL }}/{{ art.category.url }}" class="category">{{ art.category }}</a> le {{ art.date.strftime('%d/%m/%Y') }}.
</p>
<br />
<h2><a href="{{ SITEURL }}/{{ art.url }}">{{ art.title }}</a></h2>
<br />
<div class="summary">
{{ art.summary }}
</div>
<a href="{{ SITEURL }}/{{ art.url }}" class="continue">Continuer à lire</a>
</div>
{% endfor %}
{%- endmacro %}