Commit 1a9ea6c7db9966d1f95404a59e69e485c4da2c52
1 parent
576c987e
Nettoyage post-Nuit
Showing
6 changed files
with
2 additions
and
150 deletions
Show diff stats
app/models/NinfoModl.js deleted
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -var mongoose = require('mongoose'); | ||
2 | - | ||
3 | -module.exports = mongoose.model('Ninfo', { | ||
4 | - login: { | ||
5 | - type: String, | ||
6 | - default: 'login' | ||
7 | - }, | ||
8 | - equipe: { | ||
9 | - type: String, | ||
10 | - default: 'nope' | ||
11 | - }, | ||
12 | - comment: { | ||
13 | - type: String, | ||
14 | - default: '' | ||
15 | - } | ||
16 | -}); |
app/routes/ApiRtes.js
1 | var MembresServ = require('../services/MembresServ'); | 1 | var MembresServ = require('../services/MembresServ'); |
2 | -var NinfoServ = require('../services/NinfoServ'); | ||
3 | var PolyUserServ = require('../services/PolyUserServ'); | 2 | var PolyUserServ = require('../services/PolyUserServ'); |
4 | var DecryptServ = require('../services/DecryptServ'); | 3 | var DecryptServ = require('../services/DecryptServ'); |
5 | var DosssServ = require('../services/DosssServ'); | 4 | var DosssServ = require('../services/DosssServ'); |
@@ -239,47 +238,6 @@ api.post('/membres', reqBureau, assertSubject(MembresServ), function (req, res) | @@ -239,47 +238,6 @@ api.post('/membres', reqBureau, assertSubject(MembresServ), function (req, res) | ||
239 | api.delete('/membres/:_id', reqBureau, getSubject(MembresServ), delSubject(MembresServ)); | 238 | api.delete('/membres/:_id', reqBureau, getSubject(MembresServ), delSubject(MembresServ)); |
240 | 239 | ||
241 | 240 | ||
242 | -// Nuit de l'Info | ||
243 | - | ||
244 | -// Obtenir les préférences | ||
245 | -api.get('/profile/ninfo', reqAuth, addLogin, function(req, res) { | ||
246 | - NinfoServ.getLogin(req.body.login, function(err, ninfo) { | ||
247 | - NinfoServ.simpleData(ninfo, giveBack(res, 200)); | ||
248 | - }); | ||
249 | -}); | ||
250 | - | ||
251 | -// Mettre à jour les préférences | ||
252 | -api.put('/profile/ninfo', reqAuth, addLogin, assertSubject(NinfoServ), addSubject(NinfoServ)); | ||
253 | - | ||
254 | -// Lister les participants | ||
255 | -api.get('/ninfo', reqAuth, function(req, res) { | ||
256 | - NinfoServ.list(function (err, participants) { | ||
257 | - async.reduce(NinfoServ.equipes, {}, function(memo, nomEquipe, cb) { | ||
258 | - async.filter(participants, function concerne(participant, cbf) { | ||
259 | - cbf(participant.equipe == nomEquipe); | ||
260 | - }, function addInfos(membres) { | ||
261 | - async.map(membres, function (membre, cba) { | ||
262 | - async.parallel([function(cbp) { | ||
263 | - PolyUserServ.get(membre.login, cbp); | ||
264 | - }, function(cbp) { | ||
265 | - NinfoServ.simpleData(membre, cbp); | ||
266 | - }], function(err, results) { | ||
267 | - var membreFinal = results[0]; | ||
268 | - membreFinal.equipe = results[1].equipe; | ||
269 | - membreFinal.comment = results[1].comment; | ||
270 | - cba(null, membreFinal); | ||
271 | - }); | ||
272 | - }, function (err, membres) { | ||
273 | - memo[nomEquipe] = membres; | ||
274 | - cb(null, memo); | ||
275 | - }); | ||
276 | - }); | ||
277 | - }, function gb(err, data) { | ||
278 | - res.status(200).json(data); | ||
279 | - }); | ||
280 | - }); | ||
281 | -}); | ||
282 | - | ||
283 | // Dossiers | 241 | // Dossiers |
284 | 242 | ||
285 | parentId = function (req, res, next) { | 243 | parentId = function (req, res, next) { |
app/services/NinfoServ.js deleted
@@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
1 | -var NinfoModl = require('../models/NinfoModl'); | ||
2 | -var PolyUserServ = require('../services/PolyUserServ'); | ||
3 | -var async = require('async'); | ||
4 | - | ||
5 | -var NinfoServ = module.exports = { | ||
6 | - | ||
7 | - equipes: ['nope', 'ci', 'imagis', 'gis', 'ima5'], | ||
8 | - | ||
9 | - simple: ['login', 'equipe', 'comment'], | ||
10 | - | ||
11 | - simpleData: function (ninfoD, cb) { | ||
12 | - var ninfo = {}; | ||
13 | - for (var prop of NinfoServ.simple) { | ||
14 | - ninfo[prop] = ninfoD[prop]; | ||
15 | - } | ||
16 | - cb(null, ninfo); | ||
17 | - }, | ||
18 | - | ||
19 | - | ||
20 | - getLogin: function (login, cb) { | ||
21 | - NinfoModl.findOne({ | ||
22 | - login: login | ||
23 | - }, function createIfNotExist(err, ninfo) { | ||
24 | - if (ninfo) { | ||
25 | - cb(err, ninfo); | ||
26 | - } else { | ||
27 | - NinfoModl.create({login: login}, cb); | ||
28 | - } | ||
29 | - }); | ||
30 | - }, | ||
31 | - | ||
32 | - assert: function(data, cb) { | ||
33 | - cb(null, data.login && NinfoServ.equipes.indexOf(data.equipe) != -1); | ||
34 | - }, | ||
35 | - | ||
36 | - add: function (data, cb) { // Ajouter les préférences, ou les mettre | ||
37 | - // à jour (vu qu'il n'y a pas de sujet add fait les deux) | ||
38 | - // Pas de vérification car tout est fait dans assert (et login n'est pas modifié | ||
39 | - // par l'utilisateur) | ||
40 | - NinfoServ.getLogin(data.login, function(err, ninfo) { | ||
41 | - ninfo.equipe = data.equipe; | ||
42 | - ninfo.comment = data.comment; | ||
43 | - ninfo.save(cb); | ||
44 | - }); | ||
45 | - }, | ||
46 | - | ||
47 | - list: function (cb) { | ||
48 | - NinfoModl.find({}, cb); | ||
49 | - }, | ||
50 | - | ||
51 | -}; |
public/js/app.js
1 | -angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'NinfoCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl', 'ProfileCtrl']).config(function ($routeProvider, $locationProvider) { | 1 | +angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl', 'ProfileCtrl']).config(function ($routeProvider, $locationProvider) { |
2 | $routeProvider | 2 | $routeProvider |
3 | .when('/', { | 3 | .when('/', { |
4 | templateUrl: 'views/home.html' | 4 | templateUrl: 'views/home.html' |
@@ -11,8 +11,7 @@ angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'N | @@ -11,8 +11,7 @@ angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'N | ||
11 | redirectTo: 'forum/dir/root' | 11 | redirectTo: 'forum/dir/root' |
12 | }) | 12 | }) |
13 | .when('/ninfo', { | 13 | .when('/ninfo', { |
14 | - templateUrl: 'views/ninfo.html', | ||
15 | - controller: 'NinfoCtrl' | 14 | + templateUrl: 'views/ninfo.html' |
16 | }) | 15 | }) |
17 | .when('/forum/dir/:doss_id', { | 16 | .when('/forum/dir/:doss_id', { |
18 | templateUrl: 'views/forumDir.html', | 17 | templateUrl: 'views/forumDir.html', |
public/js/controllers/NinfoCtrl.js deleted
@@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
1 | -angular.module('NinfoCtrl', ['nl2br', 'SessionsServ', 'ApiServ', 'NotifyServ']) | ||
2 | - .controller('NinfoCtrl', function ($scope, SessionServ, ApiServ, NotifyServ) { | ||
3 | - $scope.ninfo = {} | ||
4 | - $scope.saving = false; | ||
5 | - | ||
6 | - $scope.session = SessionServ.cur; | ||
7 | - SessionServ.onChange(function () { | ||
8 | - $scope.session = SessionServ.cur; | ||
9 | - actualiser(); | ||
10 | - }); | ||
11 | - actualiser(); | ||
12 | - | ||
13 | - function actualiser() { | ||
14 | - if ($scope.session) { | ||
15 | - ApiServ("récupération des préférence Nuit de l'Info", 'get', 'profile/ninfo', null, function (err, ninfo) { | ||
16 | - if (!err) | ||
17 | - $scope.ninfo = ninfo; | ||
18 | - }); | ||
19 | - ApiServ("récupération de la liste des participants à Nuit de l'Info", 'get', 'ninfo', null, function (err, equipes) { | ||
20 | - if (!err) | ||
21 | - $scope.equipes = equipes; | ||
22 | - }); | ||
23 | - } | ||
24 | - } | ||
25 | - | ||
26 | - $scope.save = function () { | ||
27 | - var not = NotifyServ.promise("Sauvegarde..."); | ||
28 | - $scope.saving = true; | ||
29 | - ApiServ("sauvegarde des préférences Nuit de l'Info", 'put', 'profile/ninfo', $scope.ninfo, function (err, membre) { | ||
30 | - if (!err) { | ||
31 | - actualiser(); | ||
32 | - not.success("Sauvegardé !"); | ||
33 | - } | ||
34 | - $scope.saving = false; | ||
35 | - }); | ||
36 | - }; | ||
37 | - }); |
public/views/index.html
@@ -32,7 +32,6 @@ | @@ -32,7 +32,6 @@ | ||
32 | <script src="js/controllers/NavbarCtrl.js"></script> | 32 | <script src="js/controllers/NavbarCtrl.js"></script> |
33 | <script src="js/controllers/ConnectCtrl.js"></script> | 33 | <script src="js/controllers/ConnectCtrl.js"></script> |
34 | <script src="js/controllers/MembreCtrl.js"></script> | 34 | <script src="js/controllers/MembreCtrl.js"></script> |
35 | - <script src="js/controllers/NinfoCtrl.js"></script> | ||
36 | <script src="js/controllers/ProfileCtrl.js"></script> | 35 | <script src="js/controllers/ProfileCtrl.js"></script> |
37 | <script src="js/controllers/ForumDirCtrl.js"></script> | 36 | <script src="js/controllers/ForumDirCtrl.js"></script> |
38 | <script src="js/controllers/ForumConvCtrl.js"></script> | 37 | <script src="js/controllers/ForumConvCtrl.js"></script> |