Add buttons to set marks on collections

master
Felix Stupp 2 years ago
parent e028e0abf7
commit 7ff9a821c5
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -737,6 +737,32 @@ def api_collection_element(collection_id: int):
data = request.form.to_dict()
if "redirect" in data:
del data["redirect"]
if data.get("reset_ignored_marks", False):
for m in orm.select(
l.element for l in collection.media_links if l.element.ignored
):
m.watched = False
m.ignored = False
del data["reset_ignored_marks"]
if data.get("reset_marks", False):
for m in orm.select(
l.element for l in collection.media_links if l.element.skip_over
):
m.watched = False
m.ignored = False
del data["reset_marks"]
if "mark_unmarked_as" in data:
val = data["mark_unmarked_as"]
query = orm.select(
l.element for l in collection.media_links if not l.element.skip_over
)
if val == "watched":
for m in query:
m.watched = True
elif val == "ignored":
for m in query:
m.ignored = True
del data["mark_unmarked_as"]
KEY_CONVERTER = {
"title": str,
"notes": str,

@ -13,6 +13,13 @@
<h2>Properties</h2>
<ul>
{% set api_uri = "/api/collection/" + collection.id|string %}
<li>
{{ macros.post_form(api_uri, "mark_unmarked_as", "watched", "mark left as watched") }}
{{ macros.post_form(api_uri, "mark_unmarked_as", "ignored", "mark left as ignored") }}
{{ macros.post_form(api_uri, "reset_marks", "True", "reset marks") }}
{{ macros.post_form(api_uri, "reset_ignored_marks", "True", "reset ignored") }}
{{ macros.no_input_post_form("/api/refresh/collection/" + collection.id|string, "refresh") }}
</li>
<li>
Pinned:
{{ collection.pinned | tenary("Yes", "no") }}

Loading…
Cancel
Save