mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add some pagination on forum topics
This commit is contained in:
@ -42,7 +42,7 @@
|
||||
<div class="topic">
|
||||
<div class="ib w_medium">
|
||||
{% if first_unread %}
|
||||
<a class="ib w_big" href="{{ url('forum:view_topic', topic_id=topic.id) }}#first_unread">
|
||||
<a class="ib w_big" href="{{ topic.get_first_unread_message(user).get_absolute_url() }}">
|
||||
{% else %}
|
||||
<a class="ib w_big" href="{{ url('forum:view_topic', topic_id=topic.id) }}">
|
||||
{% endif %}
|
||||
@ -67,7 +67,9 @@
|
||||
<div class="ib w_medium" style="text-align: center;">
|
||||
{% set last_msg = topic.messages.order_by('id').select_related('author').last() %}
|
||||
{{ user_profile_link(last_msg.author) }} <br/>
|
||||
{{ last_msg.date|date(DATETIME_FORMAT) }} {{ last_msg.date|time(DATETIME_FORMAT) }}
|
||||
<a href="{{ last_msg.get_absolute_url() }}">
|
||||
{{ last_msg.date|date(DATETIME_FORMAT) }} {{ last_msg.date|time(DATETIME_FORMAT) }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
<hr>
|
||||
|
||||
{% for m in topic.messages.select_related('author__avatar_pict').order_by('-id') %}
|
||||
{% for m in topic.messages.select_related('author__avatar_pict').order_by('-id')[:10] %}
|
||||
{{ display_message(m, user) }}
|
||||
{% endfor %}
|
||||
|
||||
|
@ -38,7 +38,13 @@
|
||||
<p>{{ topic.description }}</p>
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
||||
|
||||
{% for m in topic.messages.select_related('author__avatar_pict').all() %}
|
||||
<p style="text-align: right; background: #d8e7f3;">
|
||||
{% for p in range(1, page_count + 1) %}
|
||||
<span class="ib" style="background: {% if p == current_page %}white{% endif %}; margin: 0;"><a href="?page={{ p }}">{{ p }}</a></span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
{% for m in msgs %}
|
||||
{% if m.id == first_unread_message_id %}
|
||||
<span id="first_unread"></span>
|
||||
{% endif %}
|
||||
@ -50,6 +56,12 @@
|
||||
{% endfor %}
|
||||
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
||||
|
||||
<p style="text-align: right; background: #d8e7f3;">
|
||||
{% for p in range(1, page_count + 1) %}
|
||||
<span class="ib" style="background: {% if p == current_page %}white{% endif %}; margin: 0;"><a href="?page={{ p }}">{{ p }}</a></span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user