From 4cbd13fd9cb53a38d1fcd0216e43787fc690b293 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 12 Mar 2021 13:25:58 -0500 Subject: [PATCH] feat: hide revert button in ACP > Privileges until privileges change --- public/src/admin/manage/privileges.js | 9 +++++++++ src/views/admin/manage/privileges.tpl | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public/src/admin/manage/privileges.js b/public/src/admin/manage/privileges.js index a34f49765a..d24888cb8a 100644 --- a/public/src/admin/manage/privileges.js +++ b/public/src/admin/manage/privileges.js @@ -91,6 +91,15 @@ define('admin/manage/privileges', [ throwConfirmModal('discard', Privileges.discard); }); + // Expose discard button as necessary + const containerEl = document.querySelector('.privilege-table-container'); + containerEl.addEventListener('change', (e) => { + const subselector = e.target.closest('td[data-privilege] input'); + if (subselector) { + document.getElementById('discard').style.display = containerEl.querySelectorAll('td[data-delta]').length ? 'unset' : 'none'; + } + }); + $('.privilege-table-container').on('click', '[data-action="search.user"]', Privileges.addUserToPrivilegeTable); $('.privilege-table-container').on('click', '[data-action="search.group"]', Privileges.addGroupToPrivilegeTable); $('.privilege-table-container').on('click', '[data-action="copyToChildren"]', function () { diff --git a/src/views/admin/manage/privileges.tpl b/src/views/admin/manage/privileges.tpl index 6bee79d600..3bc1dccc7b 100644 --- a/src/views/admin/manage/privileges.tpl +++ b/src/views/admin/manage/privileges.tpl @@ -22,8 +22,8 @@
-