From 8fa5ccc89aaf29843a5ab8ae4d979f53905c6545 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 20 Feb 2025 19:23:38 +0100 Subject: [PATCH] In /files view only show "show absent" option if file editing allowed. --- src/templates/files.tmpl | 4 ++++ src/ytplom/http.py | 1 + 2 files changed, 5 insertions(+) diff --git a/src/templates/files.tmpl b/src/templates/files.tmpl index bb60fc2..81ae35d 100644 --- a/src/templates/files.tmpl +++ b/src/templates/files.tmpl @@ -81,7 +81,9 @@ function draw_files_table() { async function update_files_list() { const filter_path = encodeURIComponent(document.getElementById("input_filter_path").value); let target = `${PATH_FILES_JSON}?filter_path=${filter_path}`; + {% if allow_show_absent %} if (document.getElementById("input_show_absent").checked) { target = `${target}&show_absent=1`; } + {% endif %} needed_tags.forEach((tag) => target = `${target}&needed_tag=${encodeURIComponent(tag)}`); filtered_files = await wrapped_fetch(target).then((response) => response.json()); document.getElementById("files_count").textContent = `${filtered_files.length}`; @@ -119,7 +121,9 @@ button.reverse { background-color: black; color: white; } {% block body %} filename pattern:
+{% if allow_show_absent %} show absent:
+{% endif %} needed tags:

diff --git a/src/ytplom/http.py b/src/ytplom/http.py index 4986a3c..817220a 100644 --- a/src/ytplom/http.py +++ b/src/ytplom/http.py @@ -314,6 +314,7 @@ class _TaskHandler(PlomHttpHandler): with DbConn() as conn: showable_tags = sorted(list(VideoFile.all_tags_showable(conn))) self._send_rendered_template(_NAME_TEMPLATE_FILES, { + 'allow_show_absent': self.server.config.allow_file_edit, 'showable_tags': showable_tags, 'needed_tags': self.params.all_for('needed_tag')}) -- 2.30.2