Commit 83c88813c161ff6c4355ad58b74c04acbff75d2f

Authored by Geoffrey PREUD'HOMME
1 parent 92478c1b

Ajout d'une page de profil

Fix  #6
1 -angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl']).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'
@@ -22,6 +22,10 @@ angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'F @@ -22,6 +22,10 @@ angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'F
22 templateUrl: 'views/connect.html', 22 templateUrl: 'views/connect.html',
23 controller: 'ConnectCtrl' 23 controller: 'ConnectCtrl'
24 }) 24 })
  25 + .when('/profile', {
  26 + templateUrl: 'views/profile.html',
  27 + controller: 'ProfileCtrl'
  28 + })
25 .otherwise({ 29 .otherwise({
26 redirectTo: '/' 30 redirectTo: '/'
27 }); 31 });
public/js/controllers/SessionCtrl.js renamed to public/js/controllers/NavbarCtrl.js
1 angular.module('SessionsCtrl', ['SessionsServ']) 1 angular.module('SessionsCtrl', ['SessionsServ'])
2 - .controller('SessionCtrl', function ($scope, SessionServ) { 2 + .controller('NavbarCtrl', function ($scope, SessionServ) {
3 $scope.isCollapsed = false; 3 $scope.isCollapsed = false;
4 $scope.session = SessionServ.cur; 4 $scope.session = SessionServ.cur;
5 - $scope.disconnect = function () {  
6 - SessionServ.disconnect();  
7 - };  
8 SessionServ.onChange(function () { 5 SessionServ.onChange(function () {
9 $scope.session = SessionServ.cur; 6 $scope.session = SessionServ.cur;
10 }); 7 });
public/js/controllers/ProfileCtrl.js 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +angular.module('ProfileCtrl', ['SessionsServ', 'ApiServ'])
  2 + .controller('ProfileCtrl', function ($scope, SessionServ, ApiServ) {
  3 + $scope.session = SessionServ.cur;
  4 + SessionServ.onChange(function () {
  5 + $scope.session = SessionServ.cur;
  6 + });
  7 + $scope.disconnect = function () {
  8 + SessionServ.disconnect();
  9 + };
  10 + });
public/views/index.html
@@ -28,16 +28,17 @@ @@ -28,16 +28,17 @@
28 <script src="js/services/EncryptServ.js"></script> 28 <script src="js/services/EncryptServ.js"></script>
29 <script src="js/services/SessionServ.js"></script> 29 <script src="js/services/SessionServ.js"></script>
30 <script src="js/directives/MessEditDrct.js"></script> 30 <script src="js/directives/MessEditDrct.js"></script>
31 - <script src="js/controllers/SessionCtrl.js"></script> 31 + <script src="js/controllers/NavbarCtrl.js"></script>
32 <script src="js/controllers/ConnectCtrl.js"></script> 32 <script src="js/controllers/ConnectCtrl.js"></script>
33 <script src="js/controllers/MembreCtrl.js"></script> 33 <script src="js/controllers/MembreCtrl.js"></script>
  34 + <script src="js/controllers/ProfileCtrl.js"></script>
34 <script src="js/controllers/ForumDirCtrl.js"></script> 35 <script src="js/controllers/ForumDirCtrl.js"></script>
35 <script src="js/controllers/ForumConvCtrl.js"></script> 36 <script src="js/controllers/ForumConvCtrl.js"></script>
36 <script src="js/app.js"></script> 37 <script src="js/app.js"></script>
37 </head> 38 </head>
38 39
39 <body ng-app="ciApp"> 40 <body ng-app="ciApp">
40 - <nav class="navbar navbar-inverse navbar-fixed-top" ng-controller="SessionCtrl"> 41 + <nav class="navbar navbar-inverse navbar-fixed-top" ng-controller="NavbarCtrl">
41 <div class="container-fluid"> 42 <div class="container-fluid">
42 <div class="navbar-header"> 43 <div class="navbar-header">
43 <a class="navbar-brand" href="/">Club Info</a> 44 <a class="navbar-brand" href="/">Club Info</a>
@@ -56,7 +57,9 @@ @@ -56,7 +57,9 @@
56 <ul class="nav navbar-nav navbar-right" id="SessionIndc"> 57 <ul class="nav navbar-nav navbar-right" id="SessionIndc">
57 <li> 58 <li>
58 <a ng-hide="session" href="/connect">Se connecter</a> 59 <a ng-hide="session" href="/connect">Se connecter</a>
59 - <a ng-show="session" href="#" ng-click="disconnect()">{{ session.nom }} <span class="glyphicon glyphicon-off"></span></a> 60 + <a ng-show="session" href="/profile">
  61 + <span class="glyphicon glyphicon-user"></span> {{ session.nom }}
  62 + </a>
60 </li> 63 </li>
61 </ul> 64 </ul>
62 </div> 65 </div>
public/views/profile.html 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +<div class="container">
  2 + <h1>Profil de {{ session.nom }}</h1>
  3 + <p>
  4 + <strong>Login : </strong>{{ session.login }}
  5 + </p>
  6 + <p>
  7 + <strong>Section : </strong>{{ session.section }}
  8 + </p>
  9 + <p>
  10 + <strong>Rôle : </strong>
  11 + <span ng-class="{bureau: session.bureau}">{{ session.role }}</span>
  12 + </p>
  13 + <button type="button" class="btn btn-warning" aria-label="Se déconnecter" ng-click="disconnect()">
  14 + <span class="glyphicon glyphicon-off" aria-hidden="true"></span> Se déconnecter
  15 + </button>
  16 +</div>
0 \ No newline at end of file 17 \ No newline at end of file