From f913aeac608687bb74b7b97c2099c7e9d6d1057d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sun, 27 Jul 2025 20:15:55 +0200 Subject: [PATCH] sortable w tabelach --- static/lib/css/sort_table.min.css | 1 + static/lib/js/sort_table.min.js | 4 ++++ templates/admin/admin_panel.html | 1 - templates/base.html | 2 ++ templates/user_expenses.html | 1 - 5 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 static/lib/css/sort_table.min.css create mode 100644 static/lib/js/sort_table.min.js diff --git a/static/lib/css/sort_table.min.css b/static/lib/css/sort_table.min.css new file mode 100644 index 0000000..96e8814 --- /dev/null +++ b/static/lib/css/sort_table.min.css @@ -0,0 +1 @@ +.sortable thead th:not(.no-sort){cursor:pointer}.sortable thead th:not(.no-sort)::after,.sortable thead th:not(.no-sort)::before{transition:color .1s ease-in-out;font-size:1.2em;color:rgba(0,0,0,0)}.sortable thead th:not(.no-sort)::after{margin-left:3px;content:"▸"}.sortable thead th:not(.no-sort):hover::after{color:inherit}.sortable thead th:not(.no-sort)[aria-sort=descending]::after{color:inherit;content:"▾"}.sortable thead th:not(.no-sort)[aria-sort=ascending]::after{color:inherit;content:"▴"}.sortable thead th:not(.no-sort).indicator-left::after{content:""}.sortable thead th:not(.no-sort).indicator-left::before{margin-right:3px;content:"▸"}.sortable thead th:not(.no-sort).indicator-left:hover::before{color:inherit}.sortable thead th:not(.no-sort).indicator-left[aria-sort=descending]::before{color:inherit;content:"▾"}.sortable thead th:not(.no-sort).indicator-left[aria-sort=ascending]::before{color:inherit;content:"▴"} \ No newline at end of file diff --git a/static/lib/js/sort_table.min.js b/static/lib/js/sort_table.min.js new file mode 100644 index 0000000..65070c1 --- /dev/null +++ b/static/lib/js/sort_table.min.js @@ -0,0 +1,4 @@ +document.addEventListener("click",function(d){try{var A=d.shiftKey||d.altKey,f=function k(a,l){return a.nodeName===l?a:k(a.parentNode,l)}(d.target,"TH"),v=f.parentNode,w=v.parentNode,g=w.parentNode;if("THEAD"===w.nodeName&&g.classList.contains("sortable")&&!f.classList.contains("no-sort")){var h=v.cells;for(d=0;d {% block scripts %} - + diff --git a/templates/user_expenses.html b/templates/user_expenses.html index bd0bbb5..e693a96 100644 --- a/templates/user_expenses.html +++ b/templates/user_expenses.html @@ -140,7 +140,6 @@ {% block scripts %} - {% endblock %} \ No newline at end of file