add mark as read button(s) to inbox
This commit is contained in:
@@ -166,6 +166,26 @@ def unsubscribe(thread_id):
|
|||||||
subscription.delete()
|
subscription.delete()
|
||||||
return redirect(return_to)
|
return redirect(return_to)
|
||||||
|
|
||||||
|
@bp.post('/subscriptions/unsubscribe-all/')
|
||||||
|
@login_required
|
||||||
|
def unsubscribe_all():
|
||||||
|
user = get_active_user()
|
||||||
|
|
||||||
|
@bp.post('/subscriptions/mark-read/')
|
||||||
|
@login_required
|
||||||
|
def mark_read():
|
||||||
|
# TODO: make a return_to param
|
||||||
|
user = get_active_user()
|
||||||
|
sub_ids = request.form.getlist('id[]', type=int)
|
||||||
|
now = time_now()
|
||||||
|
for sub_id in sub_ids:
|
||||||
|
sub = Subscriptions.find({'id': sub_id, 'user_id': user.id})
|
||||||
|
if not sub:
|
||||||
|
continue
|
||||||
|
sub.update({'last_seen': now})
|
||||||
|
|
||||||
|
return redirect(url_for('users.inbox', username=user.username))
|
||||||
|
|
||||||
@bp.get('/<int:thread_id>/feed.atom/')
|
@bp.get('/<int:thread_id>/feed.atom/')
|
||||||
def feed(thread_id):
|
def feed(thread_id):
|
||||||
return 'stub'
|
return 'stub'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{%- from 'common/macros.html' import subheader, timestamp, pager, babycode_editor_component -%}
|
{%- from 'common/macros.html' import subheader, timestamp, pager, babycode_editor_component, bookmark_button -%}
|
||||||
{%- from 'common/icons.html' import icn_bookmark -%}
|
{%- from 'common/icons.html' import icn_bookmark -%}
|
||||||
{%- from 'common/macros.html' import full_post, bookmark_menu with context -%}
|
{%- from 'common/macros.html' import full_post, bookmark_menu with context -%}
|
||||||
{%- extends 'base.html' -%}
|
{%- extends 'base.html' -%}
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<input type="hidden" name="last_post_id" value="{{last_post.id}}">
|
<input type="hidden" name="last_post_id" value="{{last_post.id}}">
|
||||||
<input type="submit" value="{{'Subscribe' if not get_active_user().is_subscribed(thread.id) else 'Unsubscribe'}}">
|
<input type="submit" value="{{'Subscribe' if not get_active_user().is_subscribed(thread.id) else 'Unsubscribe'}}">
|
||||||
</form>
|
</form>
|
||||||
<button disabled autocomplete='off' data-r="enhance" data-s="showBookmarkMenu" title="This feature requires JavaScript to be enabled." data-concept-kind="thread" data-concept-id="{{thread.id}}">{{icn_bookmark(24)}}Bookmark…</button>
|
{{- bookmark_button('thread', thread.id) -}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<a href="{{url_for('threads.feed', thread_id=thread.id)}}" class="linkbutton rss">Subscribe via RSS</a>
|
<a href="{{url_for('threads.feed', thread_id=thread.id)}}" class="linkbutton rss">Subscribe via RSS</a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@@ -12,7 +12,20 @@
|
|||||||
You do not have any subscriptions.
|
You do not have any subscriptions.
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endset -%}
|
{%- endset -%}
|
||||||
{{ subheader('Your inbox', topline) }}
|
{%- call() subheader('Your inbox', topline) -%}
|
||||||
|
<fieldset class="plank even no-shadow minimal subheader-actions">
|
||||||
|
<legend>Actions</legend>
|
||||||
|
<form method="POST" action="{{url_for('threads.mark_read')}}">
|
||||||
|
{%- for sub in subscriptions -%}
|
||||||
|
<input type="hidden" name="id[]" value="{{sub.id}}">
|
||||||
|
{%- endfor -%}
|
||||||
|
<button>Mark all as read</button>
|
||||||
|
</form>
|
||||||
|
<form method="POST" action="{{url_for('threads.unsubscribe_all')}}">
|
||||||
|
<button class="warn">Unsubscribe from all</button>
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
{%- endcall -%}
|
||||||
{%- if subscriptions | length > 0 -%}
|
{%- if subscriptions | length > 0 -%}
|
||||||
<div class="plank">
|
<div class="plank">
|
||||||
{%- for sub in subscriptions -%}
|
{%- for sub in subscriptions -%}
|
||||||
@@ -20,11 +33,17 @@
|
|||||||
{%- set thread = sub.get_thread() -%}
|
{%- set thread = sub.get_thread() -%}
|
||||||
<summary class="plank secondary-bg no-shadow even">
|
<summary class="plank secondary-bg no-shadow even">
|
||||||
{{thread.title}} ({{sub.get_unread_count()}} unread)
|
{{thread.title}} ({{sub.get_unread_count()}} unread)
|
||||||
<form method="POST" action="{{url_for('threads.unsubscribe', thread_id=thread.id)}}">
|
<div>
|
||||||
|
<form class="inline horizontal" method="POST" action="{{url_for('threads.unsubscribe', thread_id=thread.id)}}">
|
||||||
<input type="hidden" name="return_to" value="{{url_for('users.inbox', username=get_active_user().username)}}">
|
<input type="hidden" name="return_to" value="{{url_for('users.inbox', username=get_active_user().username)}}">
|
||||||
<a href="{{url_for('threads.thread_by_id', thread_id=thread.id)}}" class="linkbutton">Go to thread</a>
|
<a href="{{url_for('threads.thread_by_id', thread_id=thread.id)}}" class="linkbutton">Go to thread</a>
|
||||||
<input type="submit" value="Unsubscribe" class="warn">
|
<input type="submit" value="Unsubscribe" class="warn">
|
||||||
</form>
|
</form>
|
||||||
|
<form class="inline horizontal" method="POST" action="{{url_for('threads.mark_read')}}">
|
||||||
|
<input type="hidden" name="id[]" value="{{sub.id}}">
|
||||||
|
<button>Mark as read</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</summary>
|
</summary>
|
||||||
{%- set posts = sub.get_full_posts_view() -%}
|
{%- set posts = sub.get_full_posts_view() -%}
|
||||||
|
|
||||||
|
|||||||
@@ -335,6 +335,10 @@ form.horizontal {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.inline {
|
||||||
|
display: inline flex;
|
||||||
|
}
|
||||||
|
|
||||||
&> fieldset {
|
&> fieldset {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--base-padding);
|
gap: var(--base-padding);
|
||||||
|
|||||||
Reference in New Issue
Block a user