Skip to content

Commit

Permalink
fix: #7298 privilege header misalignment
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jan 26, 2019
1 parent fefec8b commit df6f75e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions public/language/en-GB/admin/manage/categories.json
Expand Up @@ -35,6 +35,7 @@
"privileges.section-viewing": "Viewing Privileges",
"privileges.section-posting": "Posting Privileges",
"privileges.section-moderation": "Moderation Privileges",
"privileges.section-other": "Other",
"privileges.section-user": "User",
"privileges.search-user": "Add User",
"privileges.no-users": "No user-specific privileges in this category.",
Expand Down
5 changes: 4 additions & 1 deletion src/privileges/categories.js
Expand Up @@ -34,7 +34,10 @@ module.exports = function (privileges) {
},
function (payload, next) {
// 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 + 2;
payload.columnCountUser = payload.labels.users.length + 2;
payload.columnCountUserOther = payload.labels.users.length - privileges.privilegeLabels.length;
payload.columnCountGroup = payload.labels.groups.length + 2;
payload.columnCountGroupOther = payload.labels.groups.length - privileges.privilegeLabels.length;
next(null, payload);
},
], callback);
Expand Down
16 changes: 13 additions & 3 deletions src/views/admin/partials/categories/privileges.tpl
Expand Up @@ -11,6 +11,11 @@
<th class="arrowed" colspan="3">
[[admin/manage/categories:privileges.section-moderation]]
</th>
<!-- IF privileges.columnCountUserOther -->
<th class="arrowed" colspan="{privileges.columnCountUserOther}">
[[admin/manage/categories:privileges.section-other]]
</th>
<!-- END -->
</tr><tr><!-- zebrastripe reset --></tr>
<tr>
<th colspan="2">[[admin/manage/categories:privileges.section-user]]</th>
Expand All @@ -35,15 +40,15 @@
</tr>
<!-- END privileges.users -->
<tr>
<td colspan="{privileges.columnCount}">
<td colspan="{privileges.columnCountUser}">
<button type="button" class="btn btn-primary pull-right" data-ajaxify="false" data-action="search.user">
[[admin/manage/categories:privileges.search-user]]
</button>
</td>
</tr>
<!-- ELSE -->
<tr>
<td colspan="{privileges.columnCount}">
<td colspan="{privileges.columnCountUser}">
[[admin/manage/categories:privileges.no-users]]
<button type="button" class="btn btn-primary pull-right" data-ajaxify="false" data-action="search.user">
[[admin/manage/categories:privileges.search-user]]
Expand All @@ -67,6 +72,11 @@
<th class="arrowed" colspan="3">
[[admin/manage/categories:privileges.section-moderation]]
</th>
<!-- IF privileges.columnCountGroupOther -->
<th class="arrowed" colspan="{privileges.columnCountGroupOther}">
[[admin/manage/categories:privileges.section-other]]
</th>
<!-- END -->
</tr><tr><!-- zebrastripe reset --></tr>
<tr>
<th colspan="2">[[admin/manage/categories:privileges.section-group]]</th>
Expand All @@ -89,7 +99,7 @@
</tr>
<!-- END privileges.groups -->
<tr>
<td colspan="{privileges.columnCount}">
<td colspan="{privileges.columnCountGroup}">
<div class="btn-toolbar">
<button type="button" class="btn btn-primary pull-right" data-ajaxify="false" data-action="search.group">
[[admin/manage/categories:privileges.search-group]]
Expand Down

0 comments on commit df6f75e

Please sign in to comment.