Skip to content

Commit

Permalink
Sort categories list by translation in the categories and groups pages
Browse files Browse the repository at this point in the history
  • Loading branch information
josegar74 committed Jan 30, 2025
1 parent d1c1c4a commit 25ec5eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
17 changes: 15 additions & 2 deletions web-ui/src/main/resources/catalog/js/admin/CategoriesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@
"$rootScope",
"$translate",
"$timeout",
function ($scope, $routeParams, $http, $rootScope, $translate, $timeout) {
"gnUtilityService",
function (
$scope,
$routeParams,
$http,
$rootScope,
$translate,
$timeout,
gnUtilityService
) {
$scope.categories = null;
$scope.categorySelected = { id: $routeParams.categoryId };

Expand Down Expand Up @@ -138,7 +147,11 @@

function loadCategories() {
$http.get("../api/tags").then(function (response) {
$scope.categories = response.data;
$scope.categories = gnUtilityService.sortByTranslation(
response.data,
$scope.lang,
"name"
);
});
}
loadCategories();
Expand Down
12 changes: 10 additions & 2 deletions web-ui/src/main/resources/catalog/js/admin/UserGroupController.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"gnConfig",
"gnConfigService",
"gnAuditableService",
"gnUtilityService",
function (
$scope,
$routeParams,
Expand All @@ -63,7 +64,8 @@
$log,
gnConfig,
gnConfigService,
gnAuditableService
gnAuditableService,
gnUtilityService
) {
$scope.searchObj = {
params: {
Expand Down Expand Up @@ -156,7 +158,13 @@
$http.get("../api/tags").then(function (response) {
var nullTag = { id: null, name: "", label: {} };
nullTag.label[$scope.lang] = "";
$scope.categories = [nullTag].concat(response.data);
var categoriesSorted = gnUtilityService.sortByTranslation(
response.data,
$scope.lang,
"name"
);

$scope.categories = [nullTag].concat(categoriesSorted);
});

function loadGroups() {
Expand Down

0 comments on commit 25ec5eb

Please sign in to comment.