From: Christian Heller Date: Thu, 20 Feb 2025 18:23:12 +0000 (+0100) Subject: To /files view add sorting by tags amount. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/templates?a=commitdiff_plain;h=cf9ca25ec6d2d0990e32c3e8ced0d8a93ebed727;p=ytplom To /files view add sorting by tags amount. --- diff --git a/src/templates/files.tmpl b/src/templates/files.tmpl index 2338cf8..bb60fc2 100644 --- a/src/templates/files.tmpl +++ b/src/templates/files.tmpl @@ -54,7 +54,10 @@ function draw_files_table() { inverter = -1; _sort_key = sort_key.substring(1); } - return inverter * ((a[_sort_key] > b[_sort_key]) ? 1 : -1); + const cmp = "tags_count" == _sort_key + ? (a.tags_showable.length > b.tags_showable.length) + : (a[_sort_key] > b[_sort_key]); + return inverter * (cmp ? 1 : -1); }); const table = document.getElementById("files_table"); Array.from(document.getElementsByClassName("file_row")).forEach((row) => row.remove()); @@ -129,7 +132,7 @@ known files (shown: ?): actions -tags +tags