Skip to content

Commit

Permalink
#345 Fix user dialog's title
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Nov 21, 2017
1 parent 8bb3570 commit 59ad377
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui/app/scripts/controllers/admin/AdminUserDialogCtrl.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function() {
'use strict';

angular.module('theHiveControllers').controller('AdminUserDialogCtrl', function($scope, $uibModalInstance, UserSrv, NotificationSrv, user) {
angular.module('theHiveControllers').controller('AdminUserDialogCtrl', function($scope, $uibModalInstance, UserSrv, NotificationSrv, user, isEdit) {
var self = this;

self.user = user;
self.isEdit = user.id;
self.isEdit = isEdit;

var formData = _.defaults(_.pick(self.user, 'id', 'name', 'roles'), {
id: null,
Expand Down
3 changes: 2 additions & 1 deletion ui/app/scripts/controllers/admin/AdminUsersCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
controllerAs: '$vm',
size: 'lg',
resolve: {
user: angular.copy(user) || {}
user: angular.copy(user) || {},
isEdit: !!user
}
});

Expand Down
4 changes: 2 additions & 2 deletions ui/app/views/partials/admin/user-dialog.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form class="form-horizontal" name="userForm" ng-submit="$vm.saveUser(userForm)" novalidate>
<div class="modal-header bg-primary">
<h3 class="modal-title">{{$vm.formData.id ? 'Update' : 'Add'}} user</h3>
<h3 class="modal-title">{{$vm.isEdit ? 'Update' : 'Add'}} user</h3>
</div>
<div class="modal-body">
<div class="form-group" ng-class="{ 'has-error' : userForm.id.$invalid && !userForm.id.$pristine }">
Expand Down Expand Up @@ -39,7 +39,7 @@ <h3 class="modal-title">{{$vm.formData.id ? 'Update' : 'Add'}} user</h3>
</label>
<div class="col-sm-9">
<div class="btn-group" uib-dropdown>
<button class="btn btn-sm dropdown-toggle" uib-dropdown-toggle type="button">
<button class="btn btn-default btn-sm dropdown-toggle" uib-dropdown-toggle type="button">
{{$vm.formData.roles.join(', ') || 'none'}}&nbsp;&nbsp;
<span class="caret"></span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/admin/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h3 class="box-title">User management</h3>
</div>
<div class="box-body">

<button class="btn btn-sm btn-primary" type="button" ng-click="showUserDialog({})">Add user</button>
<button class="btn btn-sm btn-primary" type="button" ng-click="showUserDialog()">Add user</button>

<div class="row mt-xs">
<div class="col-md-12">
Expand Down

0 comments on commit 59ad377

Please sign in to comment.