dashboard: can now change the sidebar
This commit is contained in:
parent
196f10dc9f
commit
a4e0a90adf
7 changed files with 410 additions and 57 deletions
|
|
@ -165,7 +165,7 @@ angular.module("FICApp")
|
|||
})
|
||||
.factory("Scene", function($resource) {
|
||||
return $resource("/api/public/:screenId", { screenId: '@id' }, {
|
||||
'update': {method: 'PUT', isArray: true},
|
||||
'update': {method: 'PUT'},
|
||||
})
|
||||
})
|
||||
.factory("Team", function($resource) {
|
||||
|
|
@ -573,7 +573,7 @@ angular.module("FICApp")
|
|||
.controller("PublicController", function($scope, $rootScope, $routeParams, $location, Scene, Theme, Teams, Exercice) {
|
||||
$scope.screens = [0,1,2,3,4,5,6,7,8,9];
|
||||
$scope.screenid = $routeParams.screenId;
|
||||
$scope.scenes = Scene.query({ screenId: $routeParams.screenId });
|
||||
$scope.display = Scene.get({ screenId: $routeParams.screenId });
|
||||
$scope.themes = Theme.query();
|
||||
$scope.teams = Teams.get();
|
||||
|
||||
|
|
@ -594,6 +594,14 @@ angular.module("FICApp")
|
|||
"table": "Tableau",
|
||||
"rank": "Classement",
|
||||
};
|
||||
$scope.typeside = {
|
||||
"welcome": "Messages de bienvenue",
|
||||
"themes": "Présentation des thèmes",
|
||||
"exercice_follow": "Dernier exercice des événements",
|
||||
"exercice": "Exercice",
|
||||
"message": "Message",
|
||||
"panel": "Boîte",
|
||||
};
|
||||
$scope.welcome_types = {
|
||||
"teams": "Accueil des équipes",
|
||||
"public": "Accueil du public",
|
||||
|
|
@ -625,12 +633,12 @@ angular.module("FICApp")
|
|||
|
||||
$scope.clearScene = function() {
|
||||
$scope.someUpdt = true;
|
||||
$scope.scenes = [];
|
||||
$scope.display.scenes = [];
|
||||
};
|
||||
$scope.presetScene = function(scene) {
|
||||
$scope.someUpdt = true;
|
||||
if (scene == "registration")
|
||||
$scope.scenes = [
|
||||
if (scene == "registration") {
|
||||
$scope.display.scenes = [
|
||||
{
|
||||
type: "welcome",
|
||||
params: { kind: "teams" },
|
||||
|
|
@ -640,19 +648,29 @@ angular.module("FICApp")
|
|||
params: { kind: "public", notitle: true },
|
||||
},
|
||||
];
|
||||
else if (scene == "welcome")
|
||||
$scope.scenes = [
|
||||
$scope.display.side = [
|
||||
{
|
||||
type: "welcome",
|
||||
params: { kind: "public" },
|
||||
type: "themes",
|
||||
params: { },
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (scene == "welcome") {
|
||||
$scope.display.scenes = [
|
||||
{
|
||||
type: "carousel",
|
||||
params: { color: "info", kind: "themes", title: "Présentation des entreprises ciblées"},
|
||||
},
|
||||
];
|
||||
else if (scene == "start")
|
||||
$scope.scenes = [
|
||||
$scope.display.side = [
|
||||
{
|
||||
type: "welcome",
|
||||
params: { kind: "public" },
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (scene == "start") {
|
||||
$scope.display.scenes = [
|
||||
{
|
||||
type: "welcome",
|
||||
params: { kind: "public" },
|
||||
|
|
@ -662,8 +680,15 @@ angular.module("FICApp")
|
|||
params: { color: "success", end: null, lead: "Go, go, go !", title: "Le challenge forensic va bientôt commencer !" },
|
||||
},
|
||||
];
|
||||
$scope.display.side = [
|
||||
{
|
||||
type: "themes",
|
||||
params: { },
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (scene == "summary") {
|
||||
$scope.scenes = [
|
||||
$scope.display.scenes = [
|
||||
{
|
||||
type: "table",
|
||||
params: { kind: "levels", levels: [1,2,3,4,5], themes: $scope.themes.map(function(z, i) { return z.id; }), total: true },
|
||||
|
|
@ -673,57 +698,107 @@ angular.module("FICApp")
|
|||
params: { limit: 10, which: "general" },
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (scene == "happyhour") {
|
||||
$scope.scenes = [
|
||||
$scope.display.side = [
|
||||
{
|
||||
type: "countdown",
|
||||
params: { color: "warning", end: new Date(Date.now() + 3602000).toISOString(), lead: "Terminé !", title: "Heure joyeuse : chaque résolution compte double !" },
|
||||
},
|
||||
{
|
||||
type: "rank",
|
||||
params: { limit: 10, which: "general" },
|
||||
type: "exercice_follow",
|
||||
params: { },
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (scene == "happyhour") {
|
||||
$scope.display.customCountdown = {
|
||||
show: true,
|
||||
shadow: "#E8CF5C",
|
||||
end: new Date(Date.now() + 1802000).toISOString(),
|
||||
before: "Heure joyeuse : chaque résolution compte double !",
|
||||
after: "Heure joyeuse terminée !",
|
||||
}
|
||||
}
|
||||
else if (scene == "freehintquarter") {
|
||||
$scope.display.customCountdown = {
|
||||
show: true,
|
||||
shadow: "#3DD28F",
|
||||
end: new Date(Date.now() + 902000).toISOString(),
|
||||
before: "Quart d'heure facile : indices dévoilés !",
|
||||
after: "Quart d'heure facile terminée !",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.genSceneCountdownDate = function(scene, duration) {
|
||||
scene.params.end = (new Date(Date.now() + duration)).toISOString();
|
||||
}
|
||||
$scope.genCustomCountdownDate = function(duration) {
|
||||
$scope.display.customCountdown.end = (new Date(Date.now() + duration)).toISOString();
|
||||
}
|
||||
|
||||
$scope.saveScenes = function() {
|
||||
$scope.someUpdt = false;
|
||||
var prms = Scene.update({ screenId: $scope.screenid }, $scope.scenes);
|
||||
var prms = Scene.update({ screenId: $scope.screenid }, $scope.display);
|
||||
prms.$promise.then(function() {
|
||||
$rootScope.newBox('success', 'Scene successfully published!');
|
||||
}, function(response) {
|
||||
$rootScope.newBox('danger', 'An error occurs when saving scene:', response.data.errmsg);
|
||||
});
|
||||
};
|
||||
$scope.addSide = function() {
|
||||
$scope.someUpdt = true;
|
||||
$scope.display.side.push({params: {}});
|
||||
};
|
||||
$scope.delSide = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
angular.forEach($scope.display.side, function(scene, k) {
|
||||
if (scene == s)
|
||||
$scope.display.side.splice(k, 1);
|
||||
});
|
||||
};
|
||||
$scope.upSide = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
angular.forEach($scope.display.side, function(scene, k) {
|
||||
if (scene == s && k > 0) {
|
||||
$scope.display.side.splice(k, 1);
|
||||
$scope.display.side.splice(k - 1, 0, scene);
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.downSide = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
var move = true;
|
||||
angular.forEach($scope.display.side, function(scene, k) {
|
||||
if (move && scene == s) {
|
||||
$scope.display.side.splice(k, 1);
|
||||
$scope.display.side.splice(k + 1, 0, scene);
|
||||
move = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.addScene = function() {
|
||||
$scope.someUpdt = true;
|
||||
$scope.scenes.push({params: {}});
|
||||
$scope.display.scenes.push({params: {}});
|
||||
};
|
||||
$scope.delScene = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
angular.forEach($scope.display.scenes, function(scene, k) {
|
||||
if (scene == s)
|
||||
$scope.scenes.splice(k, 1);
|
||||
$scope.display.scenes.splice(k, 1);
|
||||
});
|
||||
};
|
||||
$scope.upScene = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
angular.forEach($scope.display.scenes, function(scene, k) {
|
||||
if (scene == s && k > 0) {
|
||||
$scope.scenes.splice(k, 1);
|
||||
$scope.scenes.splice(k - 1, 0, scene);
|
||||
$scope.display.scenes.splice(k, 1);
|
||||
$scope.display.scenes.splice(k - 1, 0, scene);
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.downScene = function(s) {
|
||||
$scope.someUpdt = true;
|
||||
var move = true;
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
angular.forEach($scope.display.scenes, function(scene, k) {
|
||||
if (move && scene == s) {
|
||||
$scope.scenes.splice(k, 1);
|
||||
$scope.scenes.splice(k + 1, 0, scene);
|
||||
$scope.display.scenes.splice(k, 1);
|
||||
$scope.display.scenes.splice(k + 1, 0, scene);
|
||||
move = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Reference in a new issue