Files
pyrom/app/templates/users/bookmarks.html
2026-06-03 16:35:59 +03:00

57 lines
3.1 KiB
HTML

{%- from 'common/macros.html' import full_post, bookmark_menu with context -%}
{%- from 'common/macros.html' import subheader, bookmark_button -%}
{%- extends 'base.html' -%}
{%- block title -%}bookmarks"{%- endblock -%}
{%- block content -%}
<bitty-8 data-connect="/static/js/bits/bookmark-menu.js"></bitty-8>
<bitty-8 data-connect="/static/js/bits/bookmarks.js"></bitty-8>
{%- call() subheader('Your bookmarks') -%}
<fieldset class="plank even no-shadow minimal subheader-actions js-only" data-r="enhance">
<legend>Actions</legend>
<a href="{{url_for('users.bookmark_collections', username=get_active_user().username)}}" class="linkbutton">Manage collections</a>
</fieldset>
{%- endcall -%}
<div class="plank">
{%- for collection in collections -%}
{%- set thread_count = collection.get_threads_count() -%}
{%- set post_count = collection.get_posts_count() -%}
<details class="separated" data-id="{{collection.id}}" data-r="restoreCollectionDetails setCollectionDetails" data-s="setCollectionDetails">
<summary class="plank secondary-bg no-shadow even">{{collection.name}} ({{thread_count}} {{'thread' | pluralize(num=thread_count)}}, {{post_count}} {{'post' | pluralize(num=post_count)}})</summary>
{%- if thread_count > 0 -%}
<details class="inner" data-id="{{collection.id}}" data-r="restoreThreadDetails setThreadDetails" data-s="setThreadDetails">
<summary class="plank no-shadow even">Threads</summary>
<table>
<thead>
<tr>
<th class="plank even no-shadow contrast-bg" style="--w:65%">Title</th>
<th class="plank even no-shadow contrast-bg" style="--w:25%">Memo</th>
<th class="plank even no-shadow contrast-bg" style="--w:10%">Manage</th>
</tr>
</thead>
<tbody>
{%- for bt in collection.get_threads() -%}
{%- set thread = bt.get_thread() -%}
<tr>
<td class="center plank even no-shadow minimal secondary-bg"><a href="{{url_for('threads.thread_by_id', thread_id=thread.id)}}">{{thread.title}}</a></td>
<td class="center plank even no-shadow minimal secondary-bg">{{bt.note}}</td>
<td class="center plank even no-shadow minimal secondary-bg">{{bookmark_button('thread', id=thread.id, text='Manage')}}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</details>
{%- endif -%}
{%- if post_count > 0 -%}
<details class="inner" data-id="{{collection.id}}" data-r="restorePostDetails setPostDetails" data-s="setPostDetails">
<summary class="plank no-shadow even">Posts</summary>
{%- for bp in collection.get_posts() -%}
<div class="post plank no-shadow even">{{ full_post(bp.get_post().get_full_post_view(), render_sig=false, show_thread=true, show_reactions=false, tb_edit=false, tb_quote=false, tb_delete=false, bookmark_btn='Manage', tb_pretext=('memo: ' + bp.note) if bp.note else '') }}</div>
{%- endfor -%}
</details>
{%- endif -%}
</details>
{%- endfor -%}
</div>
{{ bookmark_menu() }}
{%- endblock -%}