Always have 3 sort elements in sort selection modal.

pull/1306/head
Richard 11 years ago
parent dac8a1ca44
commit 932d7fe0da
  1. 14
      app/assets/javascripts/angular/controllers/dialogs/sorting.js
  2. 4
      app/assets/javascripts/angular/services/query-service.js

@ -52,6 +52,10 @@ angular.module('openproject.workPackages.controllers')
return [$scope.availableColumnsData.filter(function(column) { return column.id == element.field; })[0],
$scope.availableDirectionsData.filter(function(direction) { return direction.id == element.direction; })[0]]
});
while($scope.sortElements.length < 3) {
$scope.sortElements.push([]);
}
}
$scope.getAvailableColumnsData = function(term, result) {
@ -63,9 +67,13 @@ angular.module('openproject.workPackages.controllers')
}
$scope.updateSortation = function(){
var sortElements = $scope.sortElements.map(function(element){
return { field: element[0].id, direction: element[1].id }
})
var sortElements = $scope.sortElements
.filter(function(element){
return element.length == 2;
})
.map(function(element){
return { field: element[0].id, direction: element[1].id }
})
QueryService.updateSortElements(sortElements);
sortingModal.deactivate();

@ -134,7 +134,6 @@ angular.module('openproject.services')
return QueryService.doGet(url, function(response){
availableColumns = response.data.available_columns;
return availableColumns;
<<<<<<< HEAD
});
},
@ -147,9 +146,6 @@ 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) {

Loading…
Cancel
Save