navbar: properly generate links to recent topics
This commit is contained in:
parent
262c5f22c8
commit
faf5bd184d
|
@ -32,5 +32,18 @@ def menu_processor():
|
|||
|
||||
last_active_topics = list(filter(f, last_active_topics))[:10]
|
||||
|
||||
# Constructing last news
|
||||
raw = db.session.execute( """SELECT topic.id FROM topic
|
||||
INNER JOIN forum ON topic.forum_id = forum.id
|
||||
INNER JOIN comment ON topic.thread_id = comment.thread_id
|
||||
INNER JOIN post ON post.id = comment.id
|
||||
WHERE forum.url LIKE '/actus%'
|
||||
GROUP BY topic.id
|
||||
ORDER BY MIN(post.date_created) DESC
|
||||
LIMIT 10;
|
||||
""")
|
||||
last_news = [Topic.query.get(id) for id in raw]
|
||||
|
||||
return dict(login_form=login_form, search_form=search_form,
|
||||
main_forum=main_forum, last_active_topics=last_active_topics)
|
||||
main_forum=main_forum, last_active_topics=last_active_topics,
|
||||
last_news=last_news)
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
|
||||
<h3>Derniers topics actifs</h3>
|
||||
<ul>
|
||||
{% for t in last_active_topics %}
|
||||
<li>
|
||||
<a href="{{ url_for('forum_topic', f=t.forum, page=(t,'fin'))}}">{{ t.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% for t in last_active_topics %}
|
||||
<li><a href="{{ url_for('forum_topic', f=t.forum, page=(t,'fin'))}}">{{ t.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -18,10 +18,8 @@
|
|||
|
||||
<h3>Derniers articles</h3>
|
||||
<ul>
|
||||
<li><a href="#">Un nouvel OS pour les Graph 75</a></li>
|
||||
<li><a href="#">Les 7 Days CPC arrivent bientôt</a></li>
|
||||
<li><a href="#">Résultats de jeu du mois de Février 2017</a></li>
|
||||
<li><a href="#">Test du shield relai Sainsmart pour Arduino</a></li>
|
||||
<li><a href="#">Un nouveau tutoriel sur le C-engine</a></li>
|
||||
{% for t in last_news %}
|
||||
<li><a href="{{ url_for('forum_topic', f=t.forum, page=(t,'fin'))}}">{{ t.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue