]> Raphaƫl G. Git Repositories - blogbundle/blobdiff - Resources/views/article/index.html.twig
Use entity id as last resort sorting parameter
[blogbundle] / Resources / views / article / index.html.twig
index 817a4e078b7c38eb1c8792dc642eaf6a15d786d5..512e0fa26f8a5803ed33cbfd5b8fd2188ebc11c9 100644 (file)
@@ -1,29 +1,45 @@
-{% extends 'RapsysBlogBundle::body.html.twig' %}
-{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% extends '@RapsysBlog/_base.html.twig' %}
 {% block content %}
-<section id="content">
-       <h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2>
-       {% for article in articles %}
-       <article>
+       <section id="content">
                <header>
-                       <h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3>
-                       <p>
-                               <span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
-                               {% if article.keywords %}
-                                       <span>
-                                               {% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %}
-                                               {% for slug, keyword in article.keywords %}
-                                                       <a href="{{ path('keywords_keyword', {'_keyword': slug}) }}">{{ keyword }}</a>
-                                               {% endfor %}
-                                       </span>
-                               {% endif %}
-                       </p>
+                       <h1><a href="{{ path('rapsys_blog_article') }}">{{ title }}</a></h1>
+                       <p>{{ description }}</p>
                </header>
-               <p>{{article.description}}</p>
-               <nav>
-                       <a href="{{ path('articles_article', {'_article': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a>
-               </nav>
-       </article>
-       {% endfor %}
-</section>
+               <section>
+                       {% for article in articles %}
+                               <article>
+                                       <header>
+                                               <h2><a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{{ article.title }}</a></h2>
+                                       </header>
+                                       <section>
+                                               <p>{{ article.description }}</p>
+                                               {% if article.keywords is defined and article.keywords %}
+                                                       <nav>
+                                                               {% for keyword in article.keywords %}
+                                                                       <a href="{{ path('rapsys_blog_keyword_view', {'id': keyword.id, 'slug': keyword.slug}) }}">{{ keyword.title }}</a>
+                                                               {% endfor %}
+                                                       </nav>
+                                               {% endif %}
+                                       </section>
+                                       <footer>
+                                               <nav>
+                                                       <a href="{{ path('rapsys_blog_article_view', {'id': article.id, 'slug': article.slug}) }}">{% 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 articles{% endtrans %}</a>
+                                       {% endif %}
+                                       {% if head.next is defined %}
+                                               <a href="{{ head.next }}" rel="next">{% trans %}Next articles{% endtrans %} &gt;</a>
+                                       {% endif %}
+                               </nav>
+                       </footer>
+               {% endif %}
+       </section>
 {% endblock %}