fix: column counts for other privileges

This commit is contained in:
Julian Lam
2022-03-17 13:36:50 -04:00
parent 3dc2acd739
commit e9b2fabf83
2 changed files with 5 additions and 3 deletions

View File

@@ -46,6 +46,7 @@ privsGlobal.getPrivilegeList = async () => {
};
privsGlobal.init = async () => {
privsGlobal._coreSize = _privilegeMap.size;
await plugins.hooks.fire('static:privileges.global.init', {
privileges: _privilegeMap,
});
@@ -72,8 +73,9 @@ privsGlobal.list = async function () {
});
payload.keys = keys;
// This is a hack because I can't do {labels.users.length} to echo the count in templates.js
payload.columnCount = payload.labels.users.length + 3;
payload.columnCountUserOther = keys.users.length - privsGlobal._coreSize;
payload.columnCountGroupOther = keys.groups.length - privsGlobal._coreSize;
return payload;
};

View File

@@ -66,7 +66,7 @@
{{{ if !isAdminPriv }}}
<tr class="privilege-table-header">
<th class="privilege-filters btn-toolbar" colspan="100">
<!-- IF privileges.columnCountGroupOther -->
<!-- IF privileges.columnCountUserOther -->
<button type="button" data-filter="19,99" class="btn btn-default pull-right">[[admin/manage/categories:privileges.section-other]]</button>
<!-- END -->
<button type="button" data-filter="16,18" class="btn btn-default pull-right">[[admin/manage/categories:privileges.section-moderation]]</button>