add user bookmarks view

This commit is contained in:
2025-11-20 03:49:44 +03:00
parent b86e049263
commit 95decd9a56
4 changed files with 60 additions and 2 deletions

View File

@@ -91,7 +91,7 @@
</form>
{% endmacro %}
{% macro full_post(post, render_sig = True, is_latest = False, editing = False, active_user = None, no_reply = false, Reactions = none) %}
{% macro full_post(post, render_sig = True, is_latest = False, editing = False, active_user = None, no_reply = false, Reactions = none, show_thread_title = false) %}
{% set postclass = "post" %}
{% if editing %}
{% set postclass = postclass + " editing" %}
@@ -112,6 +112,11 @@
<div class="post-content-container" {{ "id=latest-post" if is_latest else "" }}>
<div class="post-info">
<span>
{% if show_thread_title %}
<a href="{{ url_for('threads.thread', slug=post.thread_slug) }}">Thread: {{ post.thread_title }}</a>
&bullet;
{% endif %}
<a href="{{ post_permalink }}" title="Permalink"><i>
{% if (post['edited_at'] | int) > (post['created_at'] | int) %}
Edited on {{ timestamp(post['edited_at']) }}
@@ -119,6 +124,7 @@
Posted on {{ timestamp(post['edited_at']) }}
{% endif %}
</i></a>
</span>
<span>
{% set show_edit = false %}
{% if active_user %}

View File

@@ -20,6 +20,10 @@
&bullet;
<a href="{{ url_for('users.invite_links', username=user.username )}}">Invite to {{ config.SITE_NAME }}</a>
{% endif %}
{% if not user.is_guest() %}
&bullet;
<a href="{{ url_for('users.bookmarks', username=user.username) }}">Bookmarks</a>
{% endif %}
{% if user.is_mod() %}
&bullet;
<a href="{{ url_for("mod.user_list") }}">User list</a>

View File

@@ -0,0 +1,35 @@
{% from "common/macros.html" import accordion, full_post %}
{% extends "base.html" %}
{% block title %}bookmarks{% endblock %}
{% block content %}
<div class="darkbg inbox-container">
{% for collection in collections %}
{% call(section) accordion(disabled=collection.is_empty()) %}
{% if section == 'header' %}
<h1 class="thread-title">{{ collection.name }}</h1>{{" (no bookmarks)" if collection.is_empty() else ""}}
{% else %}
{% call(inner_section) accordion(disabled=not collection.has_threads()) %}
{% if inner_section == 'header' %}
Threads{{" (no bookmarks)" if not collection.has_threads() else ""}}
{% else %}
<ul>
{% for thread in collection.get_threads()|sort(attribute='created_at', reverse=true) %}
<li><a href="{{ url_for('threads.thread', slug=thread.slug) }}">{{ thread.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endcall %}
{% call(inner_section) accordion(disabled=not collection.has_posts()) %}
{% if inner_section == 'header' %}
Posts{{" (no bookmarks)" if not collection.has_posts() else ""}}
{% else %}
{% for post in collection.get_posts()|sort(attribute='created_at', reverse=true) %}
{{ full_post(post.get_full_post_view(), no_reply=false, render_sig=false, show_thread_title=true) }}
{% endfor %}
{% endif %}
{% endcall %}
{% endif %}
{% endcall %}
{% endfor %}
</div>
{% endblock %}