From: Raphaƫl Gertz <git@rapsys.eu>
Date: Tue, 12 Dec 2023 17:06:41 +0000 (+0100)
Subject: Add user index template
X-Git-Tag: 0.2~16
X-Git-Url: https://git.rapsys.eu/blogbundle/commitdiff_plain/fd5db167122dd83c920960df9d91716bd4f86d51

Add user index template
---

diff --git a/Resources/views/user/index.html.twig b/Resources/views/user/index.html.twig
new file mode 100644
index 0000000..e3049b9
--- /dev/null
+++ b/Resources/views/user/index.html.twig
@@ -0,0 +1,63 @@
+{% extends '@RapsysBlog/_base.html.twig' %}
+{% block content %}
+	<section id="content">
+		<header>
+			<h1><a href="{{ path('rapsys_blog_user') }}">{{ title }}</a></h1>
+		</header>
+		<section>
+			{% for user in users %}
+				<article>
+					<header>
+						<h2><a href="{{ user.link }}">{{ user.forename }} {{ user.surname }} ({{ user.pseudonym }}){% if is_granted('ROLE_ADMIN') %} &lt;{{ user.mail }}&gt;{% endif %}</a></h2>
+					</header>
+					{% if user.articles is defined and user.articles %}
+						<section>
+							{% for article in user.articles %}
+								<article>
+									<header>
+										<h3><a href="{{ article.link }}">{{ article.title }}</a></h3>
+									</header>
+									<section>
+										<p>{{ article.description }}</p>
+										{% if article.keywords is defined and article.keywords %}
+											<nav>
+												{% for keyword in article.keywords %}
+													<a href="{{ keyword.link }}">{{ keyword.title }}</a>
+												{% endfor %}
+											</nav>
+										{% endif %}
+									</section>
+								</article>
+								<footer>
+									<nav>
+										<a href="{{ article.link }}">{% trans %}Read more{% endtrans %}...</a>
+									</nav>
+								</footer>
+							{% endfor %}
+						</section>
+					{% endif %}
+					<footer>
+						<nav>
+							{% if is_granted('ROLE_ADMIN') %}
+								<a href="{{ user.edit }}">{% trans %}Edit{% endtrans %}</a>
+							{% endif %}
+							<a href="{{ user.link }}">{% trans %}Read more{% endtrans %}...</a>
+						</nav>
+					</footer>
+				</article>
+			{% endfor %}
+		</section>
+		{% if head.prev is defined or head.next is defined %}
+			<footer>
+				<nav class="pager">
+					{% if head.prev is defined %}
+						<a href="{{ head.prev }}" rel="prev">&lt; {% trans %}Previous users{% endtrans %}</a>
+					{% endif %}
+					{% if head.next is defined %}
+						<a href="{{ head.next }}" rel="next">{% trans %}Next users{% endtrans %} &gt;</a>
+					{% endif %}
+				</nav>
+			</footer>
+		{% endif %}
+	</section>
+{% endblock %}