Commit 33dce6999a93cd8b81ccd294880b9798354dafa9
1 parent
15a9d8f4
Redesign du forum
Showing
5 changed files
with
158 additions
and
98 deletions
Show diff stats
app/services/MessServ.js
@@ -6,6 +6,8 @@ var async = require('async'); | @@ -6,6 +6,8 @@ var async = require('async'); | ||
6 | var MesssServ = {}; | 6 | var MesssServ = {}; |
7 | 7 | ||
8 | MesssServ.addData = function (mess, cb) { | 8 | MesssServ.addData = function (mess, cb) { |
9 | + mess.auteur = {}; | ||
10 | + mess.auteur.nom = mess.login; | ||
9 | // PolyUserServ.get(Mess.login, function (err, nom) { | 11 | // PolyUserServ.get(Mess.login, function (err, nom) { |
10 | // if (nom) { | 12 | // if (nom) { |
11 | // Mess.nom = nom; | 13 | // Mess.nom = nom; |
public/js/controllers/ForumConvCtrl.js
@@ -12,23 +12,25 @@ angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ', 'ngSanitize', 'btfor | @@ -12,23 +12,25 @@ angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ', 'ngSanitize', 'btfor | ||
12 | if (!err) { | 12 | if (!err) { |
13 | $scope.conv = conv; | 13 | $scope.conv = conv; |
14 | ApiServ("récupération des messages", 'get', 'messs', conv._id, function (err, messs) { | 14 | ApiServ("récupération des messages", 'get', 'messs', conv._id, function (err, messs) { |
15 | - if (!err) | 15 | + if (!err) { |
16 | $scope.messs = messs; | 16 | $scope.messs = messs; |
17 | + } | ||
17 | }); | 18 | }); |
18 | } | 19 | } |
19 | }); | 20 | }); |
20 | 21 | ||
21 | - $scope.createMess = function () { | 22 | + $scope.addMess = function () { |
22 | data = $scope.formData; | 23 | data = $scope.formData; |
23 | data.conv = $scope.conv._id; | 24 | data.conv = $scope.conv._id; |
24 | ApiServ("envoi du message", 'post', 'messs', data, function (err, mess) { | 25 | ApiServ("envoi du message", 'post', 'messs', data, function (err, mess) { |
25 | - if (!err) | 26 | + if (!err) { |
26 | $scope.formData = {}; | 27 | $scope.formData = {}; |
27 | - $scope.messs.push(mess); | 28 | + $scope.messs.push(mess); |
29 | + } | ||
28 | }); | 30 | }); |
29 | }; | 31 | }; |
30 | 32 | ||
31 | - $scope.deleteMess = function (index) { | 33 | + $scope.delMess = function (index) { |
32 | ApiServ("suppression du message", 'delete', 'messs', $scope.messs[index]._id, function (err) { | 34 | ApiServ("suppression du message", 'delete', 'messs', $scope.messs[index]._id, function (err) { |
33 | if (!err) | 35 | if (!err) |
34 | $scope.messs.splice(index, 1); | 36 | $scope.messs.splice(index, 1); |
public/js/controllers/ForumDirCtrl.js
@@ -15,6 +15,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | @@ -15,6 +15,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | ||
15 | console.error(err); | 15 | console.error(err); |
16 | } else { | 16 | } else { |
17 | if (doss) { | 17 | if (doss) { |
18 | + $scope.doss = doss; | ||
18 | $scope.dosss = doss.dosss; | 19 | $scope.dosss = doss.dosss; |
19 | $scope.convs = doss.convs; | 20 | $scope.convs = doss.convs; |
20 | } | 21 | } |
@@ -22,7 +23,8 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | @@ -22,7 +23,8 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | ||
22 | }); | 23 | }); |
23 | 24 | ||
24 | // Dossiers | 25 | // Dossiers |
25 | - $scope.createDoss = function () { | 26 | + $scope.addDoss = function () { |
27 | + console.log('CALLA'); | ||
26 | $scope.formDoss.parent = $routeParams.doss_id; | 28 | $scope.formDoss.parent = $routeParams.doss_id; |
27 | ApiServ("création du dossier", 'post', 'dosss', $scope.formDoss, function (err, doss) { | 29 | ApiServ("création du dossier", 'post', 'dosss', $scope.formDoss, function (err, doss) { |
28 | if (!err) { | 30 | if (!err) { |
@@ -32,7 +34,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | @@ -32,7 +34,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | ||
32 | }); | 34 | }); |
33 | }; | 35 | }; |
34 | 36 | ||
35 | - $scope.deleteDoss = function (index) { | 37 | + $scope.delDoss = function (index) { |
36 | ApiServ("suppression du dossier", 'delete', 'dosss', $scope.dosss[index]._id, function (err) { | 38 | ApiServ("suppression du dossier", 'delete', 'dosss', $scope.dosss[index]._id, function (err) { |
37 | if (!err) | 39 | if (!err) |
38 | $scope.dosss.splice(index, 1); | 40 | $scope.dosss.splice(index, 1); |
@@ -40,7 +42,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | @@ -40,7 +42,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | // Conversations | 44 | // Conversations |
43 | - $scope.createConv = function () { | 45 | + $scope.addConv = function () { |
44 | $scope.formConv.parent = $routeParams.doss_id; | 46 | $scope.formConv.parent = $routeParams.doss_id; |
45 | ApiServ("création de la conversation", 'post', 'convs', $scope.formConv, function (err, conv) { | 47 | ApiServ("création de la conversation", 'post', 'convs', $scope.formConv, function (err, conv) { |
46 | if (!err) { | 48 | if (!err) { |
@@ -50,7 +52,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | @@ -50,7 +52,7 @@ angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | ||
50 | }); | 52 | }); |
51 | }; | 53 | }; |
52 | 54 | ||
53 | - $scope.deleteConv = function (index) { | 55 | + $scope.delConv = function (index) { |
54 | ApiServ("suppression de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { | 56 | ApiServ("suppression de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { |
55 | if (!err) | 57 | if (!err) |
56 | $scope.convs.splice(index, 1); | 58 | $scope.convs.splice(index, 1); |
public/views/forumConv.html
1 | <div class="container"> | 1 | <div class="container"> |
2 | <ol class="breadcrumb"> | 2 | <ol class="breadcrumb"> |
3 | <li><a href="/forum">Forum</a></li> | 3 | <li><a href="/forum">Forum</a></li> |
4 | - <li><a href="#">Conversations</a></li> | 4 | + <li>Conversations</li> |
5 | <li class="active">{{ conv.titre }}</li> | 5 | <li class="active">{{ conv.titre }}</li> |
6 | </ol> | 6 | </ol> |
7 | <h1>{{ conv.titre }}</h1> | 7 | <h1>{{ conv.titre }}</h1> |
8 | - <div class="panel panel-default" ng-repeat="mess in messs"> | ||
9 | - <div class="panel-heading"> | ||
10 | - {{ mess.login }} | ||
11 | - <button ng-show="session.canDelMess" type="button" class="btn btn-danger" ng-click="deleteMess($index)"> | ||
12 | - <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Supprimer | ||
13 | - </button> | ||
14 | - </div> | ||
15 | - <div class="panel-body" btf-markdown="mess.content"> | ||
16 | - </div> | ||
17 | - </div> | ||
18 | - <div class="form-group" ng-show="session.canAddMess"> | ||
19 | - <div class="panel panel-default"> | ||
20 | - <div class="panel-heading"> | ||
21 | - <h4 class="panel-title"> | ||
22 | - Nouveau message | ||
23 | - </h4> | ||
24 | - </div> | ||
25 | - <div class="panel-body"> | ||
26 | - <textarea class="form-control" rows="3" ng-model="formData.content"></textarea> | ||
27 | - <button type="submit" class="btn btn-primary" aria-label="Ajouter" ng-click="createMess()"> | ||
28 | - <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter | ||
29 | - </button> | ||
30 | - </div> | ||
31 | - </div> | ||
32 | - </div> | 8 | + <table class="table"> |
9 | + <thead> | ||
10 | + <tr> | ||
11 | + <th>Détails</th> | ||
12 | + <th>Message</th> | ||
13 | + <th>Actions</th> | ||
14 | + </tr> | ||
15 | + </thead> | ||
16 | + <tbody> | ||
17 | + <tr ng-repeat="mess in messs"> | ||
18 | + <td> | ||
19 | + {{ mess.auteur.image }} | ||
20 | + <br /> | ||
21 | + <span class=".visible-xs">{{ mess.auteur.login }}</span> | ||
22 | + <span class=".hidden-xs">{{ mess.auteur.nom }}</span> | ||
23 | + <br/> {{ mess.auteur.section }} | ||
24 | + <br/> {{ mess.auteur.role }} | ||
25 | + <br/> {{ doss.date }} | ||
26 | + </td> | ||
27 | + <td btf-markdown="mess.content"> | ||
28 | + </td> | ||
29 | + <td> | ||
30 | + <button type="button" class="btn btn-danger" ng-show="session.canDelMess" ng-click="delMess($index)"> | ||
31 | + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
32 | + </button> | ||
33 | + </td> | ||
34 | + </tr> | ||
35 | + <tr ng-show="session.canAddMess"> | ||
36 | + <form> | ||
37 | + <td> | ||
38 | + <label for="nvMessTitre">Nouveau message</label> | ||
39 | + </td> | ||
40 | + <td class="form-group"> | ||
41 | + <textarea class="form-control" id="nvMessTitre" rows="7" placeholder="Contenu du message" ng-model="formData.content"></textarea> | ||
42 | + </td> | ||
43 | + <td> | ||
44 | + <button type="submit" class="btn btn-primary" ng-class="{disabled: !formData.content}" ng-click="addMess()"> | ||
45 | + <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> | ||
46 | + </button> | ||
47 | + </td> | ||
48 | + </form> | ||
49 | + </tr> | ||
50 | + </tbody> | ||
51 | + </table> | ||
33 | <!-- <nav> | 52 | <!-- <nav> |
34 | <ul class="pagination"> | 53 | <ul class="pagination"> |
35 | <li> | 54 | <li> |
public/views/forumDir.html
1 | <div class="container"> | 1 | <div class="container"> |
2 | <ol class="breadcrumb"> | 2 | <ol class="breadcrumb"> |
3 | <li><a href="/forum">Forum</a></li> | 3 | <li><a href="/forum">Forum</a></li> |
4 | - <li><a href="#">Dossiers</a></li> | ||
5 | - <li class="active">{{ dossier.titre }}</li> | 4 | + <li>Dossiers</li> |
5 | + <li class="active">{{ doss.titre }}</li> | ||
6 | </ol> | 6 | </ol> |
7 | <h1>{{ doss.titre }}</h1> | 7 | <h1>{{ doss.titre }}</h1> |
8 | - <h2>Dossiers</h2> | ||
9 | - <div class="panel panel-default" ng-repeat="doss in dosss"> | ||
10 | - <div class="panel-heading"> | ||
11 | - <h3 class="panel-title"> | ||
12 | - <a href="/forum/dir/{{ doss._id }}"> | ||
13 | - <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span> {{ doss.titre }} | ||
14 | - </a> | ||
15 | - </h3> | ||
16 | - </div> | ||
17 | - <div class="panel-body"> | ||
18 | - <!-- <strong>Date : </strong>{{ doss.date }}<br/> --> | ||
19 | - <button ng-show="session.canDelDoss" type="button" class="btn btn-danger" ng-click="deleteDoss($index)"> | ||
20 | - <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Supprimer | ||
21 | - </button> | ||
22 | - </div> | ||
23 | - </div> | ||
24 | - <div class="form-group" ng-show="session.canAddDoss"> | ||
25 | - <div class="panel panel-default"> | ||
26 | - <div class="panel-heading"> | ||
27 | - <h3 class="panel-title"> | ||
28 | - <input type="text" class="form-control" placeholder="Titre du dossier" ng-model="formDoss.titre" /> | ||
29 | - </h3> | ||
30 | - </div> | ||
31 | - <div class="panel-body"> | ||
32 | - <button type="submit" class="btn btn-primary" aria-label="Ajouter" ng-click="createDoss()"> | ||
33 | - <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter | ||
34 | - </button> | ||
35 | - </div> | ||
36 | - </div> | ||
37 | - </div> | ||
38 | - <h2>Conversations</h2> | ||
39 | - <div class="panel panel-default" ng-repeat="conv in convs"> | ||
40 | - <div class="panel-heading"> | ||
41 | - <h3 class="panel-title"> | ||
42 | - <a href="/forum/conv/{{ conv._id }}"> | ||
43 | - <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> {{ conv.titre }} | ||
44 | - </a> | ||
45 | - </h3> | ||
46 | - </div> | ||
47 | - <div class="panel-body"> | ||
48 | - <!-- <strong>Date : </strong>{{ conv.date }}<br/> --> | ||
49 | - <button ng-show="session.canDelConv" type="button" class="btn btn-danger" ng-click="deleteConv($index)"> | ||
50 | - <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Supprimer | ||
51 | - </button> | ||
52 | - </div> | ||
53 | - </div> | ||
54 | - <div class="form-group" ng-show="session.canAddConv"> | ||
55 | - <div class="panel panel-default"> | ||
56 | - <div class="panel-heading"> | ||
57 | - <h3 class="panel-title"> | ||
58 | - <input type="text" class="form-control" placeholder="Titre de la conversation" ng-model="formConv.titre" /> | ||
59 | - </h3> | ||
60 | - </div> | ||
61 | - <div class="panel-body"> | ||
62 | - <!-- <textarea class="form-control" rows="3"></textarea> --> | ||
63 | - <button type="submit" class="btn btn-primary" aria-label="Ajouter" ng-click="createConv()"> | ||
64 | - <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter | ||
65 | - </button> | ||
66 | - </div> | ||
67 | - </div> | ||
68 | - </div> | 8 | + <table class="table"> |
9 | + <thead> | ||
10 | + <tr> | ||
11 | + <th>Nom</th> | ||
12 | + <th>Auteur</th> | ||
13 | + <th>Dernier message</th> | ||
14 | + <th>Actions</th> | ||
15 | + </tr> | ||
16 | + </thead> | ||
17 | + <tbody> | ||
18 | + <tr ng-repeat="doss in dosss"> | ||
19 | + <td> | ||
20 | + <a href="/forum/dir/{{ doss._id }}"> | ||
21 | + <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span> | ||
22 | + {{ doss.titre }} | ||
23 | + </a> | ||
24 | + <span class="badge" ng-hide="doss.new">{{ doss.new }}</span> | ||
25 | + </td> | ||
26 | + <td> | ||
27 | + <span class=".visible-xs">{{ doss.auteur.login }}</span> | ||
28 | + <span class=".hidden-xs">{{ doss.auteur.nom }}</span> | ||
29 | + </td> | ||
30 | + <td> | ||
31 | + {{ doss.date }} | ||
32 | + </td> | ||
33 | + <td> | ||
34 | + <button type="button" class="btn btn-default" ng-show="session.canAbonner"> | ||
35 | + <span class="glyphicon glyphicon-eye-open" aria-hidden="true" ng-show="doss.abonne"></span> | ||
36 | + <span class="glyphicon glyphicon-eye-close" aria-hidden="true" ng-hide="doss.abonne"></span> | ||
37 | + </button> | ||
38 | + <button type="button" class="btn btn-danger" ng-show="session.canDelDoss" ng-click="delDoss($index)"> | ||
39 | + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
40 | + </button> | ||
41 | + </td> | ||
42 | + </tr> | ||
43 | + <tr ng-show="session.canAddDoss"> | ||
44 | + <form> | ||
45 | + <td class="form-group"> | ||
46 | + <label for="nvDossTitre">Nouveau dossier</label> | ||
47 | + <input type="text" class="form-control" id="nvDossTitre" placeholder="Nom du dossier" ng-model="formDoss.titre" /> | ||
48 | + </td> | ||
49 | + <td> | ||
50 | + </td> | ||
51 | + <td> | ||
52 | + </td> | ||
53 | + <td> | ||
54 | + <button type="submit" class="btn btn-primary" ng-class="{disabled: !formDoss.titre}" ng-click="addDoss()"> | ||
55 | + <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> | ||
56 | + </button> | ||
57 | + </td> | ||
58 | + </form> | ||
59 | + </tr> | ||
60 | + <tr ng-repeat="conv in convs"> | ||
61 | + <td> | ||
62 | + <a href="/forum/conv/{{ conv._id }}"> | ||
63 | + <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> | ||
64 | + {{ conv.titre }} | ||
65 | + </a> | ||
66 | + <span class="badge" ng-hide="conv.new">{{ conv.new }}</span> | ||
67 | + </td> | ||
68 | + <td> | ||
69 | + <span class=".visible-xs">{{ conv.auteur.login }}</span> | ||
70 | + <span class=".hidden-xs">{{ conv.auteur.nom }}</span> | ||
71 | + </td> | ||
72 | + <td> | ||
73 | + {{ conv.date }} | ||
74 | + </td> | ||
75 | + <td> | ||
76 | + <button type="button" class="btn btn-default" ng-show="session.canAbonner"> | ||
77 | + <span class="glyphicon glyphicon-eye-open" aria-hidden="true" ng-show="conv.abonne"></span> | ||
78 | + <span class="glyphicon glyphicon-eye-close" aria-hidden="true" ng-hide="conv.abonne"></span> | ||
79 | + </button> | ||
80 | + <button type="button" class="btn btn-danger" ng-show="session.canDelConv" ng-click="delConv($index)"> | ||
81 | + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
82 | + </button> | ||
83 | + </td> | ||
84 | + </tr> | ||
85 | + <tr ng-show="session.canAddConv"> | ||
86 | + <form> | ||
87 | + <td class="form-group"> | ||
88 | + <label for="nvConvTitre">Nouvelle conversation</label> | ||
89 | + <input type="text" class="form-control" id="nvConvTitre" placeholder="Nom de la conversation" ng-model="formConv.titre" /> | ||
90 | + </td> | ||
91 | + <td> | ||
92 | + </td> | ||
93 | + <td> | ||
94 | + </td> | ||
95 | + <td> | ||
96 | + <button type="submit" class="btn btn-primary" ng-class="{disabled: !formConv.titre}" ng-click="addConv()"> | ||
97 | + <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> | ||
98 | + </button> | ||
99 | + </td> | ||
100 | + </form> | ||
101 | + </tr> | ||
102 | + </tbody> | ||
103 | + </table> | ||
69 | <!-- <nav> | 104 | <!-- <nav> |
70 | <ul class="pagination"> | 105 | <ul class="pagination"> |
71 | <li> | 106 | <li> |