Temp solution - moved sortation watcher to wp controller.

Also copied over available columns caching from columns branch.
pull/1306/head
Richard 11 years ago
parent 1351608bef
commit dac8a1ca44
  1. 6
      app/assets/javascripts/angular/controllers/dialogs/sorting.js
  2. 9
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  3. 4
      app/assets/javascripts/angular/services/query-service.js

@ -72,9 +72,9 @@ angular.module('openproject.workPackages.controllers')
} }
QueryService.getAvailableColumns() QueryService.getAvailableColumns()
.then(function(data){ .then(function(available_columns){
$scope.availableColumns = data.available_columns $scope.availableColumns = available_columns
$scope.availableColumnsData = data.available_columns.map(function(column){ $scope.availableColumnsData = available_columns.map(function(column){
return { id: column.name, label: column.title, other: column.title }; return { id: column.name, label: column.title, other: column.title };
}); });
$scope.initSortation(); $scope.initSortation();

@ -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);
}]); }]);

@ -134,6 +134,7 @@ angular.module('openproject.services')
return QueryService.doGet(url, function(response){ return QueryService.doGet(url, function(response){
availableColumns = response.data.available_columns; availableColumns = response.data.available_columns;
return availableColumns; return availableColumns;
<<<<<<< HEAD
}); });
}, },
@ -146,6 +147,9 @@ angular.module('openproject.services')
this.hideColumns(currentColumns.map(function(column) { return column.name; })); this.hideColumns(currentColumns.map(function(column) { return column.name; }));
this.showColumns(selectedColumnNames); this.showColumns(selectedColumnNames);
=======
})
>>>>>>> Temp solution - moved sortation watcher to wp controller.
}, },
updateSortElements: function(sortation) { updateSortElements: function(sortation) {

Loading…
Cancel
Save