From: Christian Heller Date: Thu, 20 Feb 2025 18:23:38 +0000 (+0100) Subject: In /files view only show "show absent" option if file editing allowed. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/index.html?a=commitdiff_plain;p=ytplom In /files view only show "show absent" option if file editing allowed. --- 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')})