public: news carousel for ranking

This commit is contained in:
nemunaire 2018-02-04 21:24:40 +01:00
parent 62aea5413e
commit 00688cb996
3 changed files with 37 additions and 0 deletions

View File

@ -548,6 +548,7 @@ angular.module("FICApp")
"exercices": "Exercices", "exercices": "Exercices",
"teams": "Équipes", "teams": "Équipes",
"themes": "Thèmes", "themes": "Thèmes",
"ranking": "Classement",
}; };
$scope.colors = { $scope.colors = {
"primary": "Primaire", "primary": "Primaire",

View File

@ -1,5 +1,15 @@
angular.module("FICApp", ["ngSanitize", "ngAnimate"]); angular.module("FICApp", ["ngSanitize", "ngAnimate"]);
angular.module("FICApp")
.filter("objectLength", function() {
return function(input) {
if (input !== undefined)
return Object.keys(input).length;
else
return "";
}
});
String.prototype.capitalize = function() { String.prototype.capitalize = function() {
return this return this
.toLowerCase() .toLowerCase()
@ -183,6 +193,7 @@ angular.module("FICApp")
this.push(team); this.push(team);
} }
}, $scope.rank); }, $scope.rank);
$scope.pagesrank = Array(Math.ceil($scope.rank.length / 7)).fill(0).map(function(v, i){ return i; });
}); });
} }
refreshData(); refreshData();

View File

@ -211,6 +211,31 @@
</div> </div>
</div> </div>
<div class="carousel slide" data-interval="10000" style="height: 260px" autocarousel ng-if="s.params.kind == 'ranking'">
<div class="carousel-inner">
<div class="carousel-item" ng-repeat="(i,t) in pagesrank" ng-class="{active: $first}">
<div class="carousel-caption">
<table class="table table-bordered table-striped table-sm">
<thead class="thead-dark">
<tr>
<th class="text-right">Place</th>
<th>Équipe</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="r in rank | orderBy: 'rank' | limitTo: 7: 7*i">
<th class="text-right">{{ r.rank }}<sup ng-if="r.rank == 1">er</sup><sup ng-if="r.rank > 1">e</sup></th>
<td>{{ r.name }}</td>
<td>{{ r.score }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="carousel slide" data-interval="30000" style="height: 270px" autocarousel ng-if="s.params.kind == 'exercices'"> <div class="carousel slide" data-interval="30000" style="height: 270px" autocarousel ng-if="s.params.kind == 'exercices'">
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<li data-slide-to="{{k}}" ng-repeat="(k, exercice) in my.exercices" ng-class="{active: $first}"></li> <li data-slide-to="{{k}}" ng-repeat="(k, exercice) in my.exercices" ng-class="{active: $first}"></li>