Put in code from loading message branch.

pull/968/head
Richard 11 years ago
parent c6ccf94aab
commit 74ad16a055
  1. 18
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  2. 2
      app/assets/javascripts/angular/directives/work_packages/query-columns-directive.js
  3. 2
      app/assets/javascripts/angular/directives/work_packages/query-form-directive.js
  4. 7
      app/assets/javascripts/angular/directives/work_packages/work-package-total-sums-directive.js
  5. 12
      app/assets/javascripts/angular/directives/work_packages/work-packages-loading-directive.js
  6. 3
      app/assets/javascripts/angular/directives/work_packages/work-packages-table-directive.js
  7. 4
      app/views/work_packages/_list.html.erb
  8. 4
      public/templates/work_packages/work_packages_loading.html

@ -31,6 +31,23 @@ angular.module('openproject.workPackages.controllers')
});
};
$scope.withLoading = function(callback, params){
startedLoading();
return callback.apply(this, params).then(function(data){
finishedLoading();
return data;
});
};
function startedLoading() {
// TODO: We could also disable/enable everything to prevent multiple updates (Or maybe we want this anyway?)
$scope.loading++;
};
function finishedLoading() {
$scope.loading--;
};
$scope.setupWorkPackagesTable = function(json) {
$scope.workPackageCountByGroup = json.work_package_count_by_group;
$scope.rows = WorkPackagesTableHelper.getRows(json.work_packages, $scope.groupBy);
@ -43,4 +60,5 @@ angular.module('openproject.workPackages.controllers')
setupQuery(gon);
$scope.setupWorkPackagesTable(gon);
$scope.loading = 0;
}]);

@ -31,7 +31,7 @@ angular.module('openproject.workPackages.directives')
var newColumns = WorkPackagesTableHelper.selectColumnsByName(scope.columns, columnNames);
// work package rows
WorkPackageService.augmentWorkPackagesWithColumnsData(workPackages, newColumns);
scope.withLoading(WorkPackageService.augmentWorkPackagesWithColumnsData, [workPackages, newColumns]);
}
function removeColumn(columnName, columns, callback) {

@ -17,7 +17,7 @@ angular.module('openproject.workPackages.directives')
});
function reloadWorkPackagesTableData() {
WorkPackageService.getWorkPackages(scope.projectIdentifier, scope.query)
scope.withLoading(WorkPackageService.getWorkPackages, [scope.projectIdentifier, scope.query])
.then(scope.setupWorkPackagesTable);
}
}

@ -9,9 +9,10 @@ angular.module('openproject.workPackages.directives')
return {
pre: function(scope, iElement, iAttrs, controller) {
function fetchSums() {
WorkPackageService.getWorkPackagesSums(scope.projectIdentifier, scope.columns).then(function(sumsData){
scope.sums = sumsData;
});
scope.withLoading(WorkPackageService.getWorkPackagesSums, [scope.projectIdentifier, scope.columns])
.then(function(sumsData){
scope.sums = sumsData;
});
}
scope.$watch('columns.length', function() {

@ -0,0 +1,12 @@
angular.module('openproject.workPackages.directives')
.directive('workPackagesLoading', ['I18n', function(I18n){
return {
restrict: 'E',
templateUrl: '/templates/work_packages/work_packages_loading.html',
scope: true,
link: function(scope, element, attributes) {
}
};
}]);

@ -15,7 +15,8 @@ angular.module('openproject.workPackages.directives')
groupByColumn: '=',
displaySums: '=',
totalSums: '=',
groupSums: '='
groupSums: '=',
withLoading: '='
},
link: function(scope, element, attributes) {
scope.I18n = I18n;

@ -42,8 +42,10 @@ See doc/COPYRIGHT.rdoc for more details.
display-sums="query.display_sums"
total-sums="totalSums"
group-sums="groupSums"
class="list issues">
class="list issues"
with-loading="withLoading">
</work-packages-table>
<work-packages-loading/>
</div>
<% end -%>

@ -0,0 +1,4 @@
<div ng-if="loading > 0"
id="ajax-indicator">
<span>Loading...</span>
</div>
Loading…
Cancel
Save