hide smart search also

This commit is contained in:
Chris Meyers 2017-01-24 15:33:18 -05:00
parent ecb3082490
commit cf52b82fa6
2 changed files with 10 additions and 6 deletions

View File

@ -222,10 +222,11 @@ export function UsersEdit($scope, $rootScope, $location,
function init() {
$scope.hidePagination = false;
$scope.hideSmartSearch = false;
$scope.user_type_options = user_type_options;
$scope.user_type = user_type_options[0];
$scope.$watch('user_type', user_type_sync($scope));
$scope.$watch('is_superuser', hidePermissionsTabPaginationIfSuperUser($scope));
$scope.$watch('is_superuser', hidePermissionsTabSmartSearchAndPaginationIfSuperUser($scope));
Rest.setUrl(defaultUrl);
Wait('start');
Rest.get(defaultUrl).success(function(data) {
@ -274,12 +275,15 @@ export function UsersEdit($scope, $rootScope, $location,
}
// Organizations and Teams tab pagination is hidden through other mechanism
function hidePermissionsTabPaginationIfSuperUser(scope) {
return function(newValue) {
if (newValue === true) {
function hidePermissionsTabSmartSearchAndPaginationIfSuperUser(scope) {
return function(isSuperuserNewValue) {
let shouldHide = isSuperuserNewValue;
if (shouldHide === true) {
scope.hidePagination = true;
} else if (newValue === false) {
scope.hideSmartSearch = true;
} else if (shouldHide === false) {
scope.hidePagination = false;
scope.hideSmartSearch = false;
}
};
}

View File

@ -1836,7 +1836,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
// smart-search directive
html += `
<div
ng-hide="${itm}.length === 0 && (searchTags | isEmpty)">
ng-hide="(${itm}.length === 0 && (searchTags | isEmpty)) || hideSmartSearch === true">
<smart-search
django-model="${itm}"
search-size="${width}"