admin: general statistics page

This commit is contained in:
nemunaire 2017-12-26 23:57:16 +01:00
parent ea3f3b709d
commit bc135d00c5
4 changed files with 38 additions and 2 deletions

View file

@ -33,6 +33,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
controller: "TeamsListController",
templateUrl: "views/team-print.html"
})
.when("/teams/export", {
controller: "TeamsListController",
templateUrl: "views/team-export.html"
})
.when("/teams/:teamId", {
controller: "TeamController",
templateUrl: "views/team-edit.html"
@ -152,6 +156,13 @@ String.prototype.capitalize = function() {
}
angular.module("FICApp")
.filter("countHints", function() {
return function(input) {
if (input == undefined)
return 0;
return input.reduce(function(sum, n){ return sum + (n.content || n.file) ? 1 : 0; }, 0);
}
})
.filter("capitalize", function() {
return function(input) {
if (input != undefined)
@ -832,6 +843,8 @@ angular.module("FICApp")
}
})
.controller("TeamController", function($scope, $rootScope, $location, Team, TeamMember, $routeParams, $http) {
if ($scope.team && $scope.team.id)
$routeParams.teamId = $scope.team.id;
$scope.team = Team.get({ teamId: $routeParams.teamId });
$scope.fields = ["name", "color"];
@ -885,7 +898,7 @@ angular.module("FICApp")
$scope.deleteTeam = function() {
backName = this.team.name;
this.team.$remove(function() { $rootScope.newBox('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); },
function(response) { console.log($rootScope.newBox); $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data); });
function(response) { $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data); });
}
$scope.showStats = function() {
$location.url("/teams/" + $scope.team.id + "/stats");