From e2593e5f2421702c7ad695231d7bff8da68bedbe Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 4 Dec 2016 19:13:44 +0100 Subject: [PATCH] frontend: redesign download part --- frontend/static/js/app.js | 22 ++++++++++++++++++++++ frontend/static/views/theme.html | 25 +++++++------------------ 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/frontend/static/js/app.js b/frontend/static/js/app.js index df0ea4fd..21f8aee3 100644 --- a/frontend/static/js/app.js +++ b/frontend/static/js/app.js @@ -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) { diff --git a/frontend/static/views/theme.html b/frontend/static/views/theme.html index ace895b2..1e538078 100644 --- a/frontend/static/views/theme.html +++ b/frontend/static/views/theme.html @@ -19,24 +19,13 @@
Téléchargements
- - - - - - - - - - - - - - - - - -
NomTailleSHA-1
{{ file.name }}{{ file.size }}{{ file.checksum }}
+
+ +

+

{{ file.name }}

+

Taille : {{ file.size | size }} – SHA-1 : {{ file.checksum }}

+
+