bookmark collections
This commit is contained in:
@@ -100,7 +100,12 @@
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro full_post(post, render_sig = True, is_latest = False, editing = False, active_user = None, no_reply = false, Reactions = none, show_thread_title = false, show_bookmark = false) %}
|
||||
{% macro full_post(
|
||||
post, render_sig = True, is_latest = False,
|
||||
editing = False, active_user = None, no_reply = false,
|
||||
Reactions = none, show_thread_title = false,
|
||||
show_bookmark = false, memo = None, bookmark_message = "Bookmark…"
|
||||
) %}
|
||||
{% set postclass = "post" %}
|
||||
{% if editing %}
|
||||
{% set postclass = postclass + " editing" %}
|
||||
@@ -122,6 +127,9 @@
|
||||
<div class="post-content-container" {{ "id=latest-post" if is_latest else "" }}>
|
||||
<div class="post-info">
|
||||
<span>
|
||||
{% if memo -%}
|
||||
Memo: <i>{{ memo }}</i> •
|
||||
{%- endif %}
|
||||
{% if show_thread_title %}
|
||||
<a href="{{ url_for('threads.thread', slug=post.thread_slug) }}">Thread: {{ post.thread_title }}</a>
|
||||
•
|
||||
@@ -174,7 +182,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if show_bookmark %}
|
||||
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Bookmark</button>
|
||||
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}{{ bookmark_message | safe }}</button>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if can_bookmark %}
|
||||
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Bookmark</button>
|
||||
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Bookmark…</button>
|
||||
{% endif %}
|
||||
{% if can_lock %}
|
||||
<form class="modform" action="{{ url_for("threads.lock", slug=thread.slug) }}" method="post">
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</span>
|
||||
<span>
|
||||
{% if active_user and not active_user.is_guest() -%}
|
||||
<button class="thread-info-bookmark-button contain-svg icon" type="button">{{ icn_bookmark(20) }}Bookmark</button>
|
||||
<button class="thread-info-bookmark-button contain-svg icon" type="button">{{ icn_bookmark(20) }}Bookmark…</button>
|
||||
{%- endif %}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
35
app/templates/users/bookmark_collections.html
Normal file
35
app/templates/users/bookmark_collections.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}managing bookmark collections{% endblock %}
|
||||
{% block content %}
|
||||
<div class="darkbg settings-container">
|
||||
<h1>Manage bookmark collections</h1>
|
||||
<p>Drag collections to reoder them. You cannot move or remove the default collection, but you can rename it.</p>
|
||||
<div>
|
||||
<button type="button" id="add-collection-button">Add new collection</button>
|
||||
<div id="collections-container">
|
||||
{% for collection in collections | sort(attribute='sort_order') %}
|
||||
<div class="draggable-collection {{ "default" if collection.is_default else ""}}"
|
||||
{% if not collection.is_default %}
|
||||
draggable="true"
|
||||
ondragover="dragOver(event)"
|
||||
ondragstart="dragStart(event)"
|
||||
ondragend="dragEnd()"
|
||||
{% else %}
|
||||
id="default-collection"
|
||||
{% endif %}
|
||||
data-collection-id="{{ collection.id }}">
|
||||
<input type="text" class="collection-name" value="{{ collection.name }}" placeholder="Collection name" required autocomplete="off" maxlength="60"><br>
|
||||
<div>{{ collection.get_threads_count() }} {{ "thread" | pluralize(num=collection.get_threads_count()) }}, {{ collection.get_posts_count() }} {{ "post" | pluralize(num=collection.get_posts_count()) }}</div>
|
||||
{% if collection.is_default %}
|
||||
<i>Default collection</i>
|
||||
{% else %}
|
||||
<button type="button" class="delete-button critical">Delete</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="button" id="save-button" data-submit-href="{{ url_for('api.manage_bookmark_collections', user_id=active_user.id) }}">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{ "/static/js/manage-bookmark-collections.js" | cachebust }}"></script>
|
||||
{% endblock %}
|
||||
@@ -1,9 +1,10 @@
|
||||
{% from "common/macros.html" import accordion, full_post %}
|
||||
{% from "common/icons.html" import icn_bookmark %}
|
||||
{% extends "base.html" %}
|
||||
{% block title %}bookmarks{% endblock %}
|
||||
{% block content %}
|
||||
<div class="darkbg inbox-container">
|
||||
{% for collection in collections %}
|
||||
{% for collection in collections | sort(attribute='sort_order') %}
|
||||
{% call(section) accordion(disabled=collection.is_empty()) %}
|
||||
{% if section == 'header' %}
|
||||
<h1 class="thread-title">{{ collection.name }}</h1>{{" (no bookmarks)" if collection.is_empty() else ""}}
|
||||
@@ -12,19 +13,34 @@
|
||||
{% 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>
|
||||
<table class="colorful-table">
|
||||
<thead>
|
||||
<th>Title</th>
|
||||
<th>Memo</th>
|
||||
<th class="small">Manage</th>
|
||||
</thead>
|
||||
{% for thread in collection.get_threads() %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ url_for('threads.thread', slug=thread.get_thread().slug) }}">{{ thread.get_thread().title }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<i>{{ thread.note }}</i>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Manage…</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% 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) }}
|
||||
{% for post in collection.get_posts() %}
|
||||
{{ full_post(post.get_post().get_full_post_view(), no_reply=false, render_sig=false, show_thread_title=true, show_bookmark=true, memo=post.note, bookmark_message="Manage…") }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
|
||||
Reference in New Issue
Block a user