add bookmark button to thread and posts in thread view
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{% from 'common/icons.html' import icn_image, icn_spoiler, icn_info, icn_lock, icn_warn, icn_error %}
|
{% from 'common/icons.html' import icn_image, icn_spoiler, icn_info, icn_lock, icn_warn, icn_error, icn_bookmark %}
|
||||||
{% macro pager(current_page, page_count) %}
|
{% macro pager(current_page, page_count) %}
|
||||||
{% set left_start = [1, current_page - 5] | max %}
|
{% set left_start = [1, current_page - 5] | max %}
|
||||||
{% set right_end = [page_count, current_page + 5] | min %}
|
{% set right_end = [page_count, current_page + 5] | min %}
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{% endmacro %}
|
{% 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) %}
|
{% 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) %}
|
||||||
{% set postclass = "post" %}
|
{% set postclass = "post" %}
|
||||||
{% if editing %}
|
{% if editing %}
|
||||||
{% set postclass = postclass + " editing" %}
|
{% set postclass = postclass + " editing" %}
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</i></a>
|
</i></a>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class="thread-actions">
|
||||||
{% set show_edit = false %}
|
{% set show_edit = false %}
|
||||||
{% if active_user %}
|
{% if active_user %}
|
||||||
{% set show_edit = (active_user.id | string) == (post['user_id'] | string) and (not post['thread_is_locked'] or active_user.is_mod()) and not no_reply %}
|
{% set show_edit = (active_user.id | string) == (post['user_id'] | string) and (not post['thread_is_locked'] or active_user.is_mod()) and not no_reply %}
|
||||||
@@ -172,6 +172,10 @@
|
|||||||
{% if show_delete %}
|
{% if show_delete %}
|
||||||
<button class="critical post-delete-button" value="{{ post['id'] }}">Delete</button>
|
<button class="critical post-delete-button" value="{{ post['id'] }}">Delete</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if show_bookmark %}
|
||||||
|
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Bookmark</button>
|
||||||
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
{% from 'common/macros.html' import pager, babycode_editor_form, full_post %}
|
{% from 'common/macros.html' import pager, babycode_editor_form, full_post %}
|
||||||
|
{% from 'common/icons.html' import icn_bookmark %}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{ thread.title }}{% endblock %}
|
{% block title %}{{ thread.title }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% set can_post = false %}
|
{% set can_post = false %}
|
||||||
{% set can_lock = false %}
|
{% set can_lock = false %}
|
||||||
{% set can_subscribe = false %}
|
{% set can_subscribe = false %}
|
||||||
|
{% set can_bookmark = false %}
|
||||||
{% if active_user %}
|
{% if active_user %}
|
||||||
{% set can_subscribe = true %}
|
{% set can_subscribe = true %}
|
||||||
|
{% set can_bookmark = not active_user.is_guest() %}
|
||||||
{% set can_post = (not thread.is_locked and not active_user.is_guest()) or active_user.is_mod() %}
|
{% set can_post = (not thread.is_locked and not active_user.is_guest()) or active_user.is_mod() %}
|
||||||
{% set can_lock = ((active_user.id | int) == (thread.user_id | int)) or active_user.is_mod() %}
|
{% set can_lock = ((active_user.id | int) == (thread.user_id | int)) or active_user.is_mod() %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -18,7 +21,7 @@
|
|||||||
• <i>stickied, so it's probably important</i>
|
• <i>stickied, so it's probably important</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div class="thread-actions">
|
||||||
{% if can_subscribe %}
|
{% if can_subscribe %}
|
||||||
<form class="modform" action="{{ url_for('threads.subscribe', slug=thread.slug) }}" method="post">
|
<form class="modform" action="{{ url_for('threads.subscribe', slug=thread.slug) }}" method="post">
|
||||||
<input type='hidden' name='last_visible_post' value='{{posts[-1].id}}'>
|
<input type='hidden' name='last_visible_post' value='{{posts[-1].id}}'>
|
||||||
@@ -26,6 +29,9 @@
|
|||||||
<input type='submit' value='{{ 'Unsubscribe' if is_subscribed else 'Subscribe' }}'>
|
<input type='submit' value='{{ 'Unsubscribe' if is_subscribed else 'Subscribe' }}'>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if can_bookmark %}
|
||||||
|
<button type="button" class="contain-svg inline icon">{{ icn_bookmark(20) }}Bookmark</button>
|
||||||
|
{% endif %}
|
||||||
{% if can_lock %}
|
{% if can_lock %}
|
||||||
<form class="modform" action="{{ url_for("threads.lock", slug=thread.slug) }}" method="post">
|
<form class="modform" action="{{ url_for("threads.lock", slug=thread.slug) }}" method="post">
|
||||||
<input type=hidden name='target_op' value="{{ (not thread.is_locked) | int }}">
|
<input type=hidden name='target_op' value="{{ (not thread.is_locked) | int }}">
|
||||||
@@ -50,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
{{ full_post(post = post, active_user = active_user, is_latest = loop.index == (posts | length), Reactions = Reactions) }}
|
{{ full_post(post = post, active_user = active_user, is_latest = loop.index == (posts | length), Reactions = Reactions, show_bookmark = can_bookmark) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{% if active_user and not active_user.is_guest() -%}
|
{% if active_user and not active_user.is_guest() -%}
|
||||||
<button class="thread-info-bookmark-button contain-svg icon" type="button">{{ icn_bookmark() }}Bookmark</button>
|
<button class="thread-info-bookmark-button contain-svg icon" type="button">{{ icn_bookmark(20) }}Bookmark</button>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ a:visited {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.post {
|
.post {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 200px 1fr;
|
grid-template-columns: 200px 1fr;
|
||||||
@@ -891,6 +897,9 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.contain-svg.inline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
.post-img-container {
|
.post-img-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ a:visited {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.post {
|
.post {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 200px 1fr;
|
grid-template-columns: 200px 1fr;
|
||||||
@@ -891,6 +897,9 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.contain-svg.inline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
.post-img-container {
|
.post-img-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ a:visited {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.post {
|
.post {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 200px 1fr;
|
grid-template-columns: 200px 1fr;
|
||||||
@@ -891,6 +897,9 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.contain-svg.inline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
.post-img-container {
|
.post-img-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -213,6 +213,13 @@ $thread_title_size: 1.5rem !default;
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$thread_actions_gap: $SMALL_PADDING !default;
|
||||||
|
.thread-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: $thread_actions_gap;
|
||||||
|
}
|
||||||
|
|
||||||
$post_usercard_width: 200px !default;
|
$post_usercard_width: 200px !default;
|
||||||
$post_border: 2px outset $DARK_2 !default;
|
$post_border: 2px outset $DARK_2 !default;
|
||||||
.post {
|
.post {
|
||||||
@@ -747,6 +754,10 @@ $thread_locked_background: none !default;
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
|
&.inline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_img_container_gap: $SMALL_PADDING !default;
|
$post_img_container_gap: $SMALL_PADDING !default;
|
||||||
|
|||||||
Reference in New Issue
Block a user