feat: hide revert button in ACP > Privileges until privileges change

v1.18.x
Julian Lam 4 years ago
parent 8472513093
commit 4cbd13fd9c

@ -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 () {

@ -22,8 +22,8 @@
</div>
<div class="floating-button">
<button id="discard" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
<i class="material-icons">delete</i>
<button id="discard" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored" style="display: none;">
<i class="material-icons">undo</i>
</button>
<button id="save" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored primary">

Loading…
Cancel
Save