admin: add public interface management
This commit is contained in:
parent
ff4e1ffbb7
commit
414e5c61cd
6 changed files with 294 additions and 0 deletions
|
@ -37,6 +37,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
|
|||
controller: "TeamNewController",
|
||||
templateUrl: "views/team-new.html"
|
||||
})
|
||||
.when("/public", {
|
||||
controller: "PublicController",
|
||||
templateUrl: "views/public.html"
|
||||
})
|
||||
.when("/events", {
|
||||
controller: "EventsListController",
|
||||
templateUrl: "views/event-list.html"
|
||||
|
@ -65,6 +69,11 @@ angular.module("FICApp")
|
|||
'update': {method: 'PUT'},
|
||||
})
|
||||
})
|
||||
.factory("Scene", function($resource) {
|
||||
return $resource("/api/public.json", null, {
|
||||
'update': {method: 'PUT'},
|
||||
})
|
||||
})
|
||||
.factory("Team", function($resource) {
|
||||
return $resource("/api/teams/:teamId", { teamId: '@id' }, {
|
||||
'update': {method: 'PUT'},
|
||||
|
@ -228,6 +237,77 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("PublicController", function($scope, Scene, Theme, Teams, Exercice) {
|
||||
$scope.scenes = Scene.query();
|
||||
$scope.themes = Theme.query();
|
||||
$scope.teams = Teams.get();
|
||||
|
||||
$scope.types = {
|
||||
"welcome": "Messages de bienvenue",
|
||||
"message": "Message",
|
||||
"panel": "Boîte",
|
||||
"exercice": "Exercice",
|
||||
"table": "Tableau",
|
||||
"rank": "Classement",
|
||||
};
|
||||
$scope.welcome_types = {
|
||||
"init": "Accueil des équipes",
|
||||
"public": "Accueil du public",
|
||||
"countdown": "Compte à rebours lancement",
|
||||
};
|
||||
$scope.panel_types = {
|
||||
"panel-default": "Default",
|
||||
"panel-info": "Info",
|
||||
"panel-success": "Success",
|
||||
"panel-warning": "Warning",
|
||||
"panel-danger": "Danger",
|
||||
};
|
||||
$scope.rank_types = {
|
||||
"general": "Classement général",
|
||||
};
|
||||
$scope.table_types = {
|
||||
"levels": "Niveaux d'exercices",
|
||||
"teams": "Équipes",
|
||||
};
|
||||
$scope.exercices = Exercice.query();
|
||||
|
||||
$scope.clearScene = function() {
|
||||
Scene.delete(function() {
|
||||
$scope.scenes = [];
|
||||
});
|
||||
};
|
||||
$scope.saveScenes = function() {
|
||||
Scene.update($scope.scenes);
|
||||
};
|
||||
$scope.addScene = function() {
|
||||
$scope.scenes.push({params: {}});
|
||||
};
|
||||
$scope.delScene = function(s) {
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
if (scene == s)
|
||||
$scope.scenes.splice(k, 1);
|
||||
});
|
||||
};
|
||||
$scope.upScene = function(s) {
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
if (scene == s && k > 0) {
|
||||
$scope.scenes.splice(k, 1);
|
||||
$scope.scenes.splice(k - 1, 0, scene);
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.downScene = function(s) {
|
||||
var move = true;
|
||||
angular.forEach($scope.scenes, function(scene, k) {
|
||||
if (move && scene == s) {
|
||||
$scope.scenes.splice(k, 1);
|
||||
$scope.scenes.splice(k + 1, 0, scene);
|
||||
move = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
|
||||
.controller("EventsListController", function($scope, Event, $location) {
|
||||
$scope.events = Event.query();
|
||||
$scope.fields = ["id", "kind", "txt", "time"];
|
||||
|
|
Reference in a new issue