frontend: redesign download part

This commit is contained in:
nemunaire 2016-12-04 19:13:44 +01:00 committed by nemunaire
parent 2472aebec4
commit e2593e5f24
2 changed files with 29 additions and 18 deletions

View File

@ -92,6 +92,28 @@ angular.module("FICApp")
}
}
})
.filter("size", function() {
var units = [
"o",
"kio",
"Mio",
"Gio",
"Tio",
"Pio",
"Eio",
"Zio",
"Yio",
]
return function(input) {
var res = input;
var unit = 0;
while (res > 1024) {
unit += 1;
res = res / 1024;
}
return (Math.round(res * 100) / 100) + " " + units[unit];
}
})
.controller("DataController", function($sce, $scope, $http, $rootScope, $timeout) {
var actMenu = function() {
if ($scope.my && $scope.themes) {

View File

@ -19,24 +19,13 @@
<div class="panel-heading">
<div class="panel-title"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> Téléchargements</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th></th>
<th>Nom</th>
<th>Taille</th>
<th>SHA-1</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="file in my.exercices[current_exercice].files">
<td><a href="{{ file.path }}" target="_self"><span class="glyphicon glyphicon-download" aria-hidden="true"></span></a></td>
<td>{{ file.name }}</td>
<td>{{ file.size }}</td>
<td><code>{{ file.checksum }}</code></td>
</tr>
</tbody>
</table>
<div class="list-group">
<a href="{{ file.path }}" target="_self" class="list-group-item" ng-repeat="file in my.exercices[current_exercice].files">
<h1 class="pull-left" style="margin: 7px 7px 5px -5px"><span class="glyphicon glyphicon-download" aria-hidden="true"></span></h1>
<h4 class="list-group-item-heading"><strong><samp>{{ file.name }}</samp></strong></h4>
<p class="list-group-item-text">Taille : <span title="{{ file.size }} octets">{{ file.size | size }}</span> &ndash; SHA-1 : <samp>{{ file.checksum }}</samp></p>
</a>
</div>
</div>
<div class="panel panel-danger" ng-show="my.team_id && my.exercices[current_exercice] && !(my.exercices[current_exercice].solved)">