hide pagination based on superness of user

This commit is contained in:
Chris Meyers
2017-01-23 11:22:06 -05:00
parent 8f9aecf716
commit ecb3082490
2 changed files with 14 additions and 1 deletions

View File

@@ -221,9 +221,11 @@ export function UsersEdit($scope, $rootScope, $location,
init(); init();
function init() { function init() {
$scope.hidePagination = false;
$scope.user_type_options = user_type_options; $scope.user_type_options = user_type_options;
$scope.user_type = user_type_options[0]; $scope.user_type = user_type_options[0];
$scope.$watch('user_type', user_type_sync($scope)); $scope.$watch('user_type', user_type_sync($scope));
$scope.$watch('is_superuser', hidePermissionsTabPaginationIfSuperUser($scope));
Rest.setUrl(defaultUrl); Rest.setUrl(defaultUrl);
Wait('start'); Wait('start');
Rest.get(defaultUrl).success(function(data) { Rest.get(defaultUrl).success(function(data) {
@@ -271,6 +273,17 @@ 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) {
scope.hidePagination = true;
} else if (newValue === false) {
scope.hidePagination = false;
}
};
}
function setScopeFields(data) { function setScopeFields(data) {
_(data) _(data)

View File

@@ -1975,7 +1975,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
//html += "</div>\n"; // close well //html += "</div>\n"; // close well
html += "</div>\n"; // close list-wrapper div html += "</div>\n"; // close list-wrapper div
html += `<paginate base-path="${collection.basePath}" dataset="${collection.iterator}_dataset" iterator="${collection.iterator}">`; html += `<paginate base-path="${collection.basePath}" dataset="${collection.iterator}_dataset" iterator="${collection.iterator}" ng-hide="hidePagination">`;
return html; return html;
} }
}; };