diff --git a/app/assets/javascripts/angular/controllers/dialogs/sorting.js b/app/assets/javascripts/angular/controllers/dialogs/sorting.js index 58933e23b5..276b08006a 100644 --- a/app/assets/javascripts/angular/controllers/dialogs/sorting.js +++ b/app/assets/javascripts/angular/controllers/dialogs/sorting.js @@ -72,9 +72,9 @@ angular.module('openproject.workPackages.controllers') } QueryService.getAvailableColumns() - .then(function(data){ - $scope.availableColumns = data.available_columns - $scope.availableColumnsData = data.available_columns.map(function(column){ + .then(function(available_columns){ + $scope.availableColumns = available_columns + $scope.availableColumnsData = available_columns.map(function(column){ return { id: column.name, label: column.title, other: column.title }; }); $scope.initSortation(); diff --git a/app/assets/javascripts/angular/controllers/work-packages-controller.js b/app/assets/javascripts/angular/controllers/work-packages-controller.js index 554c97af8d..053e3b14ac 100644 --- a/app/assets/javascripts/angular/controllers/work-packages-controller.js +++ b/app/assets/javascripts/angular/controllers/work-packages-controller.js @@ -245,4 +245,13 @@ angular.module('openproject.workPackages.controllers') } }); + // Note: Again, this was in the work packages table directive but in an isolated scope so it wasn't picking up the changes to sortation. + // Think it would probably be a good idea to have the table directive just share the scope but that requires a refactor. + $scope.$watch('query.sortation.sortElements', function(oldValue, newValue) { + if (JSON.stringify(newValue) != JSON.stringify(oldValue)) { + $scope.updateResults(); + $scope.updateBackUrl(); + } + }, true); + }]); diff --git a/app/assets/javascripts/angular/services/query-service.js b/app/assets/javascripts/angular/services/query-service.js index 88a365e91b..20e8deaa61 100644 --- a/app/assets/javascripts/angular/services/query-service.js +++ b/app/assets/javascripts/angular/services/query-service.js @@ -134,6 +134,7 @@ angular.module('openproject.services') return QueryService.doGet(url, function(response){ availableColumns = response.data.available_columns; return availableColumns; +<<<<<<< HEAD }); }, @@ -146,6 +147,9 @@ angular.module('openproject.services') this.hideColumns(currentColumns.map(function(column) { return column.name; })); this.showColumns(selectedColumnNames); +======= + }) +>>>>>>> Temp solution - moved sortation watcher to wp controller. }, updateSortElements: function(sortation) {