add bookmarks view

This commit is contained in:
2026-06-02 17:58:06 +03:00
parent edfa2e232f
commit 2c8bc6dca8
15 changed files with 223 additions and 46 deletions

View File

@@ -136,10 +136,16 @@
</div>
{%- endmacro %}
{% macro bookmark_button(kind, id, text='Bookmark') -%}
<button autocomplete='off' data-r="enhance" data-s="showBookmarkMenu" disabled title="This feature requires JavaScript to be enabled." data-concept-kind="{{kind}}" data-concept-id="{{id}}">{{icn_bookmark(24)}}{{text}}&hellip;</button>
{%- endmacro %}
{% macro full_post(
post, render_sig=true, is_latest=false,
show_toolbar=true, is_editing=false, thread=none,
show_reactions=true, show_thread=false, allow_reacting=true
show_reactions=true, show_thread=false, allow_reacting=true,
tb_edit=true, tb_quote=true, tb_delete=true, tb_bookmark=true,
bookmark_btn='Bookmark', tb_pretext=''
) -%}
{%- if is_logged_in() -%}
{%- set can_delete = post.user_id == get_active_user().id or is_mod() -%}
@@ -169,6 +175,9 @@
<div class="post-content">
<div class="plank even minimal secondary-bg no-shadow post-info">
<span>
{%- if tb_pretext -%}
<span>{{tb_pretext}} &bullet; </span>
{%- endif -%}
<a href="{{get_post_url(post.id, _anchor=true)}}">
{%- if post.edited_at <= post.created_at -%}
<i>Posted on {{timestamp(post.created_at)}}</i>
@@ -181,17 +190,19 @@
{%- endif -%}
</span>
{%- if show_toolbar -%}
<span class="thread-actions">
{%- if owns -%}
<span class="subheader-actions">
{%- if owns and tb_edit -%}
<a class="linkbutton" href="{{url_for('posts.edit', post_id=post.id, _anchor='babycode-content')}}">Edit</a>
{%- endif -%}
{%- if can_reply -%}
{%- if can_reply and tb_quote -%}
<button autocomplete='off' data-r="enhance" data-s="babycodeEditorQuote" disabled title="This feature requires JavaScript to be enabled." data-quote="{{post.original_markup}}" data-poster-name="{{ post.display_name if post.display_name else post.username }}">Quote</button>
{%- endif -%}
{%- if can_delete -%}
{%- if can_delete and tb_delete -%}
<a class="linkbutton critical" href="{{url_for('posts.delete', post_id=post.id)}}">Delete</a>
{%- endif -%}
<button autocomplete='off' data-r="enhance" data-s="showBookmarkMenu" disabled title="This feature requires JavaScript to be enabled." data-concept-kind="post" data-concept-id="{{post.id}}">{{icn_bookmark(24)}}Bookmark&hellip;</button>
{%- if tb_bookmark -%}
{{ bookmark_button('post', post.id, bookmark_btn) }}
{%- endif -%}
</span>
{%- endif -%}
</div>
@@ -229,6 +240,18 @@
</div>
{%- endmacro %}
{% macro bookmark_menu() -%}
{%- if is_logged_in() -%}
<div id="bookmark-popover" data-r="showBookmarkMenu" class="plank even" popover>
<div class="bookmark-menu-header">
<span>Bookmark collections</span>
<a href="{{url_for('users.bookmarks', username=get_active_user().username)}}">View bookmarks</a>
</div>
<div class="bookmark-menu-inner" data-r="fillBookmarkMenu">Loading&hellip;</div>
</div>
{%- endif -%}
{%- endmacro %}
{% macro infobox(message, kind=InfoboxKind.INFO) -%}
<div class="infobox plank top contain-svg horizontal {{InfoboxHTMLClass[kind]}}">
{%- if kind == InfoboxKind.INFO -%}