From cb97af2f8a208d213623747bab47102af94b697e Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 29 Jan 2020 16:01:11 +0100 Subject: [PATCH] admin: redesign home page --- admin/index.go | 35 ++++++++++++++++++++ admin/static.go | 3 ++ admin/static/index.html | 35 ++++++++++++++++++++ admin/static/js/app.js | 10 ++++++ admin/static/views/home.html | 63 ++++++++++++++++++++++++++++++++++-- 5 files changed, 143 insertions(+), 3 deletions(-) diff --git a/admin/index.go b/admin/index.go index d46fc70c..444157a9 100644 --- a/admin/index.go +++ b/admin/index.go @@ -26,6 +26,41 @@ const indextpl = ` .bg-wchoices { background-color: #c07bdf !important; } + .table th.frotated { + border: 0; + } + .table th.rotated { + height: 100px; + width: 40px; + min-width: 40px; + max-width: 40px; + position: relative; + vertical-align: bottom; + padding: 0; + font-size: 12px; + line-height: 0.9; + border: 0; + } + + th.rotated > div { + position: relative; + top: 0px; + left: -50px; + height: 100%; + transform: skew(45deg,0deg); + overflow: hidden; + border: 1px solid #000; + } + th.rotated div a { + transform: skew(-45deg,0deg) rotate(45deg); + position: absolute; + bottom: 40px; + left: -35px; + display: inline-block; + width: 110px; + text-align: left; + text-overflow: ellipsis; + } diff --git a/admin/static.go b/admin/static.go index 160ff758..69052426 100644 --- a/admin/static.go +++ b/admin/static.go @@ -63,6 +63,9 @@ func init() { api.Router().GET("/files/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { http.ServeFile(w, r, path.Join(fic.FilesDir, strings.TrimPrefix(r.URL.Path, "/files"))) }) + api.Router().GET("/submissions/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + http.ServeFile(w, r, path.Join(api.TimestampCheck, strings.TrimPrefix(r.URL.Path, "/submissions"))) + }) api.Router().GET("/vids/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { if importer, ok := sync.GlobalImporter.(sync.LocalImporter); ok { http.ServeFile(w, r, path.Join(importer.Base, strings.TrimPrefix(r.URL.Path, "/vids"))) diff --git a/admin/static/index.html b/admin/static/index.html index 463c5105..0096007b 100644 --- a/admin/static/index.html +++ b/admin/static/index.html @@ -24,6 +24,41 @@ .bg-wchoices { background-color: #c07bdf !important; } + .table th.frotated { + border: 0; + } + .table th.rotated { + height: 100px; + width: 40px; + min-width: 40px; + max-width: 40px; + position: relative; + vertical-align: bottom; + padding: 0; + font-size: 12px; + line-height: 0.9; + border: 0; + } + + th.rotated > div { + position: relative; + top: 0px; + left: -50px; + height: 100%; + transform: skew(45deg,0deg); + overflow: hidden; + border: 1px solid #000; + } + th.rotated div a { + transform: skew(-45deg,0deg) rotate(45deg); + position: absolute; + bottom: 40px; + left: -35px; + display: inline-block; + width: 110px; + text-align: left; + text-overflow: ellipsis; + } diff --git a/admin/static/js/app.js b/admin/static/js/app.js index bf91546c..13df1b7d 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -2000,6 +2000,16 @@ angular.module("FICApp") solvedByThemesPie("#pieThemes", themes); }); }) + .controller("TeamsJSONController", function($scope, Teams) { + $scope.teams = Teams.get(); + $scope.teams.$promise.then(function(teams) { + $scope.rank = []; + Object.keys(teams).forEach(function(team) { + $scope.teams[team].id = team; + $scope.rank.push($scope.teams[team]); + }) + }); + }) .controller("TeamExercicesController", function($scope, Teams, Themes, TeamMy, Exercice, $routeParams) { $scope.teams = Teams.get(); $scope.themes = Themes.get(); diff --git a/admin/static/views/home.html b/admin/static/views/home.html index 3544a9c8..eea45d14 100644 --- a/admin/static/views/home.html +++ b/admin/static/views/home.html @@ -6,19 +6,76 @@ Version de l'API : {{ v.version }}

- Latence frontend-backend :
+ Latence frontend-backend :
Dernière synchronisation du frontend : {{ t.frontend | date:"mediumTime" }}

+ Problèmes dans les fichiers :
+ +
+
+
+

Progression

+
+ + + + + + + + + + + + + + + + + + + +
Challenge {{ lvl }} + + {{ exercice.solved_count }} + {{ exercice.team_tries }} + +
+    Résolus + Total résolus
+    Tentatives +
+ {{ mystats.themes[tid].solved }}
+ {{ mystats.themes[tid].tries }} +
+
+ +
+
+

Classement

+
+ + + + + + + + +
{{ team.rank }}{{ team.name }}{{ team.score | number:0 }}
+
+