From ac04356e61e71ed2b4920749b3af09d805773dc9 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sat, 21 Mar 2015 11:56:41 +0100 Subject: [PATCH] Afficher les contrôles de membre si loggué uniquement --- app/controllers/sessions.js | 4 ---- public/js/app.js | 2 +- public/js/controllers/MembreCtrl.js | 6 ++++-- public/views/membres.html | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/controllers/sessions.js b/app/controllers/sessions.js index 9ced69b..25883f1 100644 --- a/app/controllers/sessions.js +++ b/app/controllers/sessions.js @@ -2,10 +2,6 @@ var Session = require('../models/session'); var sessions = {} -sessions.find = function (id, cb) { - Session.findById(id, cb) -} - sessions.valid = function (session) { return session.started.setSeconds(session.started.getSeconds() + 3600) > new Date() } diff --git a/public/js/app.js b/public/js/app.js index 949ac57..736dc1a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1 +1 @@ -angular.module('ciApp', ['ngRoute', 'appRoutes', 'MembreCtrl', 'SessionsServ', 'SessionsCtrl', 'ConnectCtrl']); \ No newline at end of file +angular.module('ciApp', ['ngRoute', 'appRoutes', 'SessionsServ', 'SessionsCtrl', 'ConnectCtrl', 'MembreCtrl']); \ No newline at end of file diff --git a/public/js/controllers/MembreCtrl.js b/public/js/controllers/MembreCtrl.js index 2974b08..d59f927 100644 --- a/public/js/controllers/MembreCtrl.js +++ b/public/js/controllers/MembreCtrl.js @@ -1,6 +1,8 @@ -angular.module('MembreCtrl', []).controller('MembreController', ['$scope', '$http', - function ($scope, $http) { +angular.module('MembreCtrl', []).controller('MembreController', ['$scope', '$http', 'SessionService', + function ($scope, $http, SessionService) { $scope.formData = {}; + $scope.canAdd = SessionService.logged + $scope.canDel = SessionService.logged // when landing on the page, get all Membres and show them $http.get('/api/membres') diff --git a/public/views/membres.html b/public/views/membres.html index 73dd17e..2ca9fc4 100644 --- a/public/views/membres.html +++ b/public/views/membres.html @@ -10,7 +10,7 @@ Nom Section Rôle - Action + Action @@ -18,13 +18,13 @@ {{ membre.login }} {{ membre.section }} {{ membre.role }} - - + -- libgit2 0.21.2