Commit f0a7357da17bda40a57e23077fa9d25d9fe29ee9

Authored by Geoffrey PREUD'HOMME
1 parent d0649a9e

Gestion des retours à la ligne dans les commentaires

public/js/controllers/NinfoCtrl.js
1 -angular.module('NinfoCtrl', ['SessionsServ', 'ApiServ', 'NotifyServ']) 1 +angular.module('NinfoCtrl', ['nl2br', 'SessionsServ', 'ApiServ', 'NotifyServ'])
2 .controller('NinfoCtrl', function ($scope, SessionServ, ApiServ, NotifyServ) { 2 .controller('NinfoCtrl', function ($scope, SessionServ, ApiServ, NotifyServ) {
3 $scope.ninfo = {} 3 $scope.ninfo = {}
4 $scope.saving = false; 4 $scope.saving = false;
public/js/filters/nl2brFltr.js 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +angular.module('nl2br', [])
  2 + .filter('nl2br', function ($sce) { // From http://stackoverflow.com/questions/15449325/how-can-i-preserve-new-lines-in-an-angular-partial#15449549
  3 + return function(text) {
  4 + text = text.replace(/\n/g, '<br />');
  5 + return $sce.trustAsHtml(text);
  6 + }
  7 +});
public/views/index.html
@@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
23 <script src="libs/showdown/compressed/Showdown.min.js"></script> 23 <script src="libs/showdown/compressed/Showdown.min.js"></script>
24 <script src="libs/angular-markdown-directive/markdown.js"></script> 24 <script src="libs/angular-markdown-directive/markdown.js"></script>
25 <script src="libs/ng-sortable/dist/ng-sortable.min.js"></script> 25 <script src="libs/ng-sortable/dist/ng-sortable.min.js"></script>
  26 + <script src="js/filters/nl2brFltr.js"></script>
26 <script src="js/services/NotifyServ.js"></script> 27 <script src="js/services/NotifyServ.js"></script>
27 <script src="js/services/ApiServ.js"></script> 28 <script src="js/services/ApiServ.js"></script>
28 <script src="js/services/EncryptServ.js"></script> 29 <script src="js/services/EncryptServ.js"></script>
public/views/ninfo.html
@@ -61,22 +61,22 @@ @@ -61,22 +61,22 @@
61 <h3>Équipe Informatiquement Vôtre <span class="badge">{{ equipes.ci.length }}</span></h3> 61 <h3>Équipe Informatiquement Vôtre <span class="badge">{{ equipes.ci.length }}</span></h3>
62 <div class="panel panel-default" ng-repeat="membre in equipes.ci"> 62 <div class="panel panel-default" ng-repeat="membre in equipes.ci">
63 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div> 63 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div>
64 - <div class="panel-body" ng-show="membre.comment">{{ membre.comment }}</div> 64 + <div class="panel-body" ng-show="membre.comment" ng-bind-html="membre.comment | nl2br"></div>
65 </div> 65 </div>
66 <h3>Équipe 404 Brain Not Found <span class="badge">{{ equipes.imagis.length }}</span></h3> 66 <h3>Équipe 404 Brain Not Found <span class="badge">{{ equipes.imagis.length }}</span></h3>
67 <div class="panel panel-default" ng-repeat="membre in equipes.imagis"> 67 <div class="panel panel-default" ng-repeat="membre in equipes.imagis">
68 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div> 68 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div>
69 - <div class="panel-body" ng-show="membre.comment">{{ membre.comment }}</div> 69 + <div class="panel-body" ng-show="membre.comment" ng-bind-html="membre.comment | nl2br"></div>
70 </div> 70 </div>
71 <h3>Équipe GIS <span class="badge">{{ equipes.gis.length }}</span></h3> 71 <h3>Équipe GIS <span class="badge">{{ equipes.gis.length }}</span></h3>
72 <div class="panel panel-default" ng-repeat="membre in equipes.gis"> 72 <div class="panel panel-default" ng-repeat="membre in equipes.gis">
73 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div> 73 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div>
74 - <div class="panel-body" ng-show="membre.comment">{{ membre.comment }}</div> 74 + <div class="panel-body" ng-show="membre.comment" ng-bind-html="membre.comment | nl2br"></div>
75 </div> 75 </div>
76 <h3>Équipe IMA5 (fermée) <span class="badge">{{ equipes.ima5.length }}</span></h3> 76 <h3>Équipe IMA5 (fermée) <span class="badge">{{ equipes.ima5.length }}</span></h3>
77 <div class="panel panel-default" ng-repeat="membre in equipes.ima5"> 77 <div class="panel panel-default" ng-repeat="membre in equipes.ima5">
78 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div> 78 <div class="panel-heading"><strong>{{ membre.nom }}</strong> ({{ membre.section }})</div>
79 - <div class="panel-body" ng-show="membre.comment">{{ membre.comment }}</div> 79 + <div class="panel-body" ng-show="membre.comment" ng-bind-html="membre.comment | nl2br"></div>
80 </div> 80 </div>
81 </div> 81 </div>
82 <br/> 82 <br/>