feat(controller): add post lists controller
This commit is contained in:
36
templates/list_post/list.html.twig
Normal file
36
templates/list_post/list.html.twig
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% for post in posts %}
|
||||
<div class="card t-post-detail">
|
||||
<div class="card-header">
|
||||
<a class="t-detail-a" href="{{ path('detail_post', {postId: post.id}) }}">#{{ post.id }} - <span class="t-post-title">{{ post.title|u.truncate(80, '...', true)}}</span></a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text t-post-body">
|
||||
{{ post.body|u.truncate(80, '...', true) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination t-pagination">
|
||||
{% if not page.firstPageVisible %}
|
||||
<li class="page-item t-page-item"><a class="page-link t-page-link" href="{{ path('page_list', {page: 1}) }}">1…</a></li>
|
||||
{% endif %}
|
||||
{% for i in page.visiblePages %}
|
||||
<li class="page-item {% if i == page.currentPage %}active{% endif %} t-page-item">
|
||||
{% if i == page.currentPage %}
|
||||
<span class="page-link">{{ i }}</span>
|
||||
{% else %}
|
||||
<a class="page-link t-page-link" href="{{ path('page_list', {page: i}) }}">{{ i }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if not page.lastPageVisible %}
|
||||
<li class="page-item t-page-item"><a class="page-link t-page-link" href="{{ path('page_list', {page: page.lastPage}) }}">…{{ page.lastPage }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user