diff --git a/admin/static/js/app.js b/admin/static/js/app.js index fd3912fd..83f356d0 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -1,180 +1,180 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"]) - .config(function($routeProvider, $locationProvider) { - $routeProvider - .when("/themes", { - controller: "ThemesListController", - templateUrl: "views/theme-list.html" - }) - .when("/themes/:themeId", { - controller: "ThemeController", - templateUrl: "views/theme.html" - }) - .when("/themes/:themeId/exercices/:exerciceId", { - controller: "ExerciceController", - templateUrl: "views/exercice.html" - }) - .when("/repositories", { - controller: "RepositoriesController", - templateUrl: "views/repositories.html" - }) - .when("/sync", { - controller: "SyncController", - templateUrl: "views/sync.html" - }) - .when("/settings", { - controller: "SettingsController", - templateUrl: "views/settings.html" - }) - .when("/pki", { - controller: "PKIController", - templateUrl: "views/pki.html" - }) - .when("/exercices", { - controller: "AllExercicesListController", - templateUrl: "views/exercice-list.html" - }) - .when("/exercices/:exerciceId", { - controller: "ExerciceController", - templateUrl: "views/exercice.html" - }) - .when("/exercices/:exerciceId/flags", { - controller: "ExerciceController", - templateUrl: "views/exercice-flags.html" - }) - .when("/exercices/:exerciceId/resolution", { - controller: "ExerciceController", - templateUrl: "views/exercice-resolution.html" - }) - .when("/tags", { - controller: "TagsListController", - templateUrl: "views/tags.html" - }) - .when("/teams", { - controller: "TeamsListController", - templateUrl: "views/team-list.html" - }) - .when("/teams/print", { - 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" - }) - .when("/teams/:teamId/stats", { - controller: "TeamController", - templateUrl: "views/team-stats.html" - }) - .when("/teams/:teamId/score", { - controller: "TeamController", - templateUrl: "views/team-score.html" - }) - .when("/public/:screenId", { - controller: "PublicController", - templateUrl: "views/public.html" - }) - .when("/files", { - controller: "FilesListController", - templateUrl: "views/file-list.html" - }) - .when("/events", { - controller: "EventsListController", - templateUrl: "views/event-list.html" - }) - .when("/events/:eventId", { - controller: "EventController", - templateUrl: "views/event.html" - }) - .when("/claims", { - controller: "ClaimsListController", - templateUrl: "views/claim-list.html" - }) - .when("/claims/:claimId", { - controller: "ClaimController", - templateUrl: "views/claim.html" - }) - .when("/", { - templateUrl: "views/home.html" - }); - $locationProvider.html5Mode(true); - }); + .config(function ($routeProvider, $locationProvider) { + $routeProvider + .when("/themes", { + controller: "ThemesListController", + templateUrl: "views/theme-list.html" + }) + .when("/themes/:themeId", { + controller: "ThemeController", + templateUrl: "views/theme.html" + }) + .when("/themes/:themeId/exercices/:exerciceId", { + controller: "ExerciceController", + templateUrl: "views/exercice.html" + }) + .when("/repositories", { + controller: "RepositoriesController", + templateUrl: "views/repositories.html" + }) + .when("/sync", { + controller: "SyncController", + templateUrl: "views/sync.html" + }) + .when("/settings", { + controller: "SettingsController", + templateUrl: "views/settings.html" + }) + .when("/pki", { + controller: "PKIController", + templateUrl: "views/pki.html" + }) + .when("/exercices", { + controller: "AllExercicesListController", + templateUrl: "views/exercice-list.html" + }) + .when("/exercices/:exerciceId", { + controller: "ExerciceController", + templateUrl: "views/exercice.html" + }) + .when("/exercices/:exerciceId/flags", { + controller: "ExerciceController", + templateUrl: "views/exercice-flags.html" + }) + .when("/exercices/:exerciceId/resolution", { + controller: "ExerciceController", + templateUrl: "views/exercice-resolution.html" + }) + .when("/tags", { + controller: "TagsListController", + templateUrl: "views/tags.html" + }) + .when("/teams", { + controller: "TeamsListController", + templateUrl: "views/team-list.html" + }) + .when("/teams/print", { + 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" + }) + .when("/teams/:teamId/stats", { + controller: "TeamController", + templateUrl: "views/team-stats.html" + }) + .when("/teams/:teamId/score", { + controller: "TeamController", + templateUrl: "views/team-score.html" + }) + .when("/public/:screenId", { + controller: "PublicController", + templateUrl: "views/public.html" + }) + .when("/files", { + controller: "FilesListController", + templateUrl: "views/file-list.html" + }) + .when("/events", { + controller: "EventsListController", + templateUrl: "views/event-list.html" + }) + .when("/events/:eventId", { + controller: "EventController", + templateUrl: "views/event.html" + }) + .when("/claims", { + controller: "ClaimsListController", + templateUrl: "views/claim-list.html" + }) + .when("/claims/:claimId", { + controller: "ClaimController", + templateUrl: "views/claim.html" + }) + .when("/", { + templateUrl: "views/home.html" + }); + $locationProvider.html5Mode(true); + }); function setCookie(name, value, days) { - var expires; + var expires; - if (days) { - var date = new Date(); - date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); - expires = "; expires=" + date.toGMTString(); - } else { - expires = ""; - } - document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/"; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toGMTString(); + } else { + expires = ""; + } + document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/"; } function getCookie(name) { - var nameEQ = encodeURIComponent(name) + "="; - var ca = document.cookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) === ' ') - c = c.substring(1, c.length); - if (c.indexOf(nameEQ) === 0) - return decodeURIComponent(c.substring(nameEQ.length, c.length)); - } - return null; + var nameEQ = encodeURIComponent(name) + "="; + var ca = document.cookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) === ' ') + c = c.substring(1, c.length); + if (c.indexOf(nameEQ) === 0) + return decodeURIComponent(c.substring(nameEQ.length, c.length)); + } + return null; } angular.module("FICApp") - .directive('autofocus', ['$timeout', function($timeout) { - return { - restrict: 'A', - link : function($scope, $element) { - $timeout(function() { - $element[0].focus(); - }); - } - } - }]) + .directive('autofocus', ['$timeout', function ($timeout) { + return { + restrict: 'A', + link: function ($scope, $element) { + $timeout(function () { + $element[0].focus(); + }); + } + } + }]) - .component('toast', { - bindings: { - date: '=', - msg: '=', - timeout: '=', - title: '=', - variant: '=', - yesNo: '=', - onyes: '=', - onno: '=', - }, - controller: function($element) { - if (this.timeout === 0) - $element.children(0).toast({autohide: false}); - else if (!this.timeout && this.timeout !== 0) - $element.children(0).toast({delay: 7000}); - else - $element.children(0).toast({delay: this.timeout}); - $element.children(0).toast('show'); - $element.children(0).on('hidden.bs.toast', function() { - $element.children(0).toast('dispose'); - }); - this.yesFunc = function() { - $element.children(0).toast('hide'); - if (this.onyes) - this.onyes(); - } - this.noFunc = function() { - $element.children(0).toast('hide'); - if (this.onno) - this.onno(); - } - }, - template: `