diff --git a/horilla_theme/static/horilla_theme/assets/css/v1_styles.css b/horilla_theme/static/horilla_theme/assets/css/v1_styles.css index 9a5a7d864..ea8369d22 100644 --- a/horilla_theme/static/horilla_theme/assets/css/v1_styles.css +++ b/horilla_theme/static/horilla_theme/assets/css/v1_styles.css @@ -2198,18 +2198,18 @@ ul.errorlist ul.errorlist li { } /* LIST DESIGN */ -.mylist { +.list-checked { display: flex; flex-flow: column; } -.mylist li { +.list-checked li { margin: 5px 0; position: relative; padding-left: 20px; } -.mylist li:before { +.list-checked li:before { content: "\f058"; font-family: "Font Awesome 6 Free"; font-weight: 600; @@ -2384,11 +2384,19 @@ ul.errorlist ul.errorlist li { visibility: visible; } +.oh-permission-table--toggle:hover .oh-permission-table__collapse { + visibility: visible; +} + .oh-permission-table__tr .oh-sticky-table__sd { width: 35%; } .oh-permission-count { + display: none; +} + +.oh-permission-table--collapsed .oh-permission-count { width: 100%; display: flex; padding: 0.5rem 0rem; diff --git a/horilla_theme/static/horilla_theme/assets/js/footerScripts.js b/horilla_theme/static/horilla_theme/assets/js/footerScripts.js index 04ef428da..60a41cdc9 100644 --- a/horilla_theme/static/horilla_theme/assets/js/footerScripts.js +++ b/horilla_theme/static/horilla_theme/assets/js/footerScripts.js @@ -8,6 +8,14 @@ $(function () { }); }); +function onAllHtmxSettled(callback, delay = 500) { + let timer; + document.body.addEventListener("htmx:afterSettle", function () { + clearTimeout(timer); + timer = setTimeout(() => callback(), delay); + }); +} + Toast = Swal.mixin({ toast: true, icon: "success", @@ -643,8 +651,7 @@ $(document).on("htmx:afterSettle", function (event) { if ($(".oh-permission-table--toggle").length > 0) { $(".oh-permission-table--toggle").each(function () { - const $this = $(this); - $this.closest("tr").addClass("oh-permission-table--collapsed") + $(this).closest("tr").addClass("oh-permission-table--collapsed") }); } }); @@ -672,3 +679,11 @@ $(document).on("click", ".oh-accordion-header", function(event) { event.stopImmediatePropagation(); $(this).closest(".oh-accordion").toggleClass("oh-accordion--show"); }); + +onAllHtmxSettled(function () { + $(".oh-permission-table--toggle:not(.oh-sticky-table__tr)").each(function () { + this.addEventListener("click", function (e) { + $(this).closest("tr").toggleClass("oh-permission-table--collapsed"); + }); + }); +});