Skip to content

Commit

Permalink
fix(users): enhance disabled user UI
Browse files Browse the repository at this point in the history
This commit makes sure the strikethrough and muted classes are applied
to both the username and displayname of the user page.  This gives a
great visual indicator.  I've also added the classes dynamically to
remove the dependency on another template.
  • Loading branch information
jniles committed Jul 28, 2017
1 parent 5a04825 commit 1cd7da2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
3 changes: 0 additions & 3 deletions client/src/modules/users/templates/user.name.cell.html

This file was deleted.

21 changes: 11 additions & 10 deletions client/src/modules/users/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
</ol>

<div class="toolbar">
<div class="toolbar-item">
<button
type="button"
class="btn btn-default text-capitalize"
ui-sref="users.create"
data-method="create">
<i class="fa fa-plus"></i> <span translate>USERS.ADD_USER</span>
</button>
</div>

<div class="toolbar-item">
<button
type="button"
Expand All @@ -15,17 +25,8 @@
ng-class="{ 'btn-info' : UsersCtrl.filterEnabled }">
<i class="fa fa-filter"></i>
</button>
</div>

<div class="toolbar-item">
<button
type="button"
class="btn btn-default text-capitalize"
ui-sref="users.create"
data-method="create">
<i class="fa fa-plus"></i> <span translate>USERS.ADD_USER</span>
</button>
</div>

</div>
</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions client/src/modules/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ function UsersController($state, Users, Notify, Modal, uiGridConstants) {
vm.filterEnabled = false;
vm.toggleFilter = toggleFilter;

// this function selectively applies the muted cell classes to
// disabled user entities
function muteDisabledCells(grid, row, col, rowRenderIndex, colRenderIndex) {
if (row.entity.deactivated) { return 'text-muted strike'; }
}

// options for the UI grid
vm.gridOptions = {
appScopeProvider : vm,
Expand All @@ -22,8 +28,8 @@ function UsersController($state, Users, Notify, Modal, uiGridConstants) {
enableSorting : true,
onRegisterApi : onRegisterApiFn,
columnDefs : [
{ field : 'display_name', displayName : 'FORM.LABELS.USERNAME', headerCellFilter : 'translate', enableFiltering : true },
{ field : 'username', displayName : 'FORM.LABELS.LOGIN', headerCellFilter : 'translate', cellTemplate : '/modules/users/templates/user.name.cell.html', enableFiltering : true },
{ field : 'display_name', displayName : 'FORM.LABELS.USERNAME', headerCellFilter : 'translate', cellClass : muteDisabledCells, enableFiltering : true },
{ field : 'username', displayName : 'FORM.LABELS.LOGIN', headerCellFilter : 'translate', cellClass : muteDisabledCells, enableFiltering : true },
{ field : 'action', displayName : '', cellTemplate : '/modules/users/templates/grid/action.cell.html', enableSorting : false, enableFiltering : false },
],
};
Expand Down

0 comments on commit 1cd7da2

Please sign in to comment.