home · contact · privacy
In /files view only show "show absent" option if file editing allowed. master
authorChristian Heller <c.heller@plomlompom.de>
Thu, 20 Feb 2025 18:23:38 +0000 (19:23 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 20 Feb 2025 18:23:38 +0000 (19:23 +0100)
src/templates/files.tmpl
src/ytplom/http.py

index bb60fc2b9706f230e354c638ae1422e8730b3263..81ae35dfbb6089a3246c8551435e738d9335306e 100644 (file)
@@ -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}`;
 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`; }
     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}`;
     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: <input id="input_filter_path" oninput="update_files_list()"  /><br />
 
 {% block body %}
 filename pattern: <input id="input_filter_path" oninput="update_files_list()"  /><br />
+{% if allow_show_absent %}
 show absent: <input id="input_show_absent" type="checkbox" onclick="update_files_list()" /><br />
 show absent: <input id="input_show_absent" type="checkbox" onclick="update_files_list()" /><br />
+{% endif %}
 needed tags: <select id="tags_select" onchange="select_tag()"></select><br />
 <span id="tags"></span>
 <hr />
 needed tags: <select id="tags_select" onchange="select_tag()"></select><br />
 <span id="tags"></span>
 <hr />
index 4986a3c9e34bbb11cf99400ae1953d5d55651ba4..817220a764bf4439176a8318db806c06185f1f5e 100644 (file)
@@ -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, {
         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')})
 
             'showable_tags': showable_tags,
             'needed_tags': self.params.all_for('needed_tag')})