diff --git a/css/useradmin.css b/css/useradmin.css index 2b06a99..ae200c3 100644 --- a/css/useradmin.css +++ b/css/useradmin.css @@ -83,6 +83,10 @@ div#alert-container { margin-left: 5px; } +/* This is needed because otherwise the delete icon in textboxes is hidden while field has focus. */ +.has-feedback .form-control-feedback { + z-index: 3; +} diff --git a/js/angular-app.js b/js/angular-app.js index 48888d9..f4fbe05 100644 --- a/js/angular-app.js +++ b/js/angular-app.js @@ -191,15 +191,25 @@ - useradminApp.directive('usradmGroupAddListAccordion', function(editUserService) { + useradminApp.directive('usradmGroupAddListAccordion', + function(editUserService, filterFilter) { return { restrict: 'E', templateUrl: 'templates/groupAddList.html', scope: { groupData: '=groupData', + searchText: '=searchText', }, link: function(scope, elemet, attrs) { scope.editUserService = editUserService; + + scope.ouFilterPredicate = function(searchText) { + return function(ouItem) { + let filteredGroups = filterFilter(ouItem.groups, searchText); + let availableGroups = filteredGroups.filter(group => !editUserService.userHasGroup(group)); + return (availableGroups.length > 0); + } + } } }; }); @@ -369,13 +379,26 @@ - useradminApp.directive('usradmGroupAddModal', function() { + useradminApp.directive('usradmGroupAddModal', function(filterFilter) { return { restrict: 'E', templateUrl: 'templates/groupAddModal.html', scope: { groupData: '=groupData' - } + }, + controller: function() { + this.searchText = ""; + + this.changedSearch = function() { + let ouCount = filterFilter(this.groupData, this.searchText).length; + if (ouCount === 1) { + // Automatically open the only existing ou + $("#accordion>div>div.panel-collapse").collapse('toggle') + } + } + }, + controllerAs: "groupAddModal", + bindToController: true, }; }); diff --git a/templates/groupAddList.html b/templates/groupAddList.html index b549107..c2eed37 100644 --- a/templates/groupAddList.html +++ b/templates/groupAddList.html @@ -1,5 +1,5 @@
-
+
@@ -16,7 +16,7 @@

  • diff --git a/templates/groupAddModal.html b/templates/groupAddModal.html index 6bcb32f..7946fb6 100644 --- a/templates/groupAddModal.html +++ b/templates/groupAddModal.html @@ -8,8 +8,23 @@