Add ui elements for group selection

This commit is contained in:
Johannes Zellner
2016-02-10 14:26:04 +01:00
parent 19982b1815
commit 9fb276019e
2 changed files with 18 additions and 5 deletions

View File

@@ -122,6 +122,12 @@
</div>
<input type="email" class="form-control" ng-model="useredit.email" id="inputUserEditEmail" name="email" required>
</div>
<div class="form-group">
<label class="control-label" for="inputUserEditGroups">Groups</label>
<div>
<button class="btn btn-default" data-toggle="button" ng-repeat="group in groups" ng-click="userEditToggleGroup(group);">{{ group.name }}</button>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error': (useredit_form.password.$dirty && useredit_form.password.$invalid) || (!useredit_form.password.$dirty && useredit.error.password)}">
<label class="control-label" for="inputusereditPassword">Give your password to verify that you are performing that action</label>
<div class="control-label" ng-show="(!useredit_form.password.$dirty && useredit.error.password) || (useredit_form.password.$dirty && useredit_form.password.$invalid)">
@@ -182,7 +188,6 @@
<td class="text-right" style="vertical-align: bottom">
<button ng-show="!isMe(user) && userInfo.admin" class="btn btn-xs btn-danger" ng-click="showUserRemove(user)" title="Remove User"><i class="fa fa-trash-o"></i></button>
<button ng-show="!isMe(user) && userInfo.admin" class="btn btn-xs btn-default" ng-click="sendInvite(user)" title="Send Invite"><i class="fa fa-paper-plane-o"></i></button>
<button ng-show="userInfo.admin" class="btn btn-xs btn-default" ng-click="manageUserGroups(user)" title="Manage Groups"><i class="fa fa-group"></i></button>
<button ng-show="userInfo.admin" class="btn btn-xs btn-default" ng-click="showUserEdit(user)" title="Edit User Profile"><i class="fa fa-pencil"></i></button>
</td>
</tr>

View File

@@ -5,6 +5,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.ready = false;
$scope.users = [];
$scope.groups = [];
$scope.userInfo = Client.getUserInfo();
$scope.userremove = {
@@ -134,6 +135,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.useredit.displayName = userInfo.displayName;
$scope.useredit.email = userInfo.email;
$scope.useredit.userInfo = userInfo;
$scope.useredit.groups = userInfo.groupIds;
$scope.useredit_form.$setPristine();
$scope.useredit_form.$setUntouched();
@@ -231,11 +233,17 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
};
function refresh() {
Client.listUsers(function (error, result) {
if (error) return console.error('Unable to get user listing.', error);
Client.getGroups(function (error, result) {
if (error) return console.error('Unable to get group listing.', error);
$scope.users = result.users;
$scope.ready = true;
$scope.groups = result;
Client.listUsers(function (error, result) {
if (error) return console.error('Unable to get user listing.', error);
$scope.users = result.users;
$scope.ready = true;
});
});
}