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 @@