From 20a0d5536cdd2e6e5822daa349f8cc2578a15e0f Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sat, 11 Apr 2015 02:29:54 +0200 Subject: [PATCH] Il parait que les dépendances ça sert à rien alors... --- public/js/app.js | 60 +++++++++++++++++++++++++++++------------------------------- public/js/controllers/ConnectCtrl.js | 7 +++---- public/js/controllers/ForumConvCtrl.js | 7 +++---- public/js/controllers/ForumDirCtrl.js | 49 +++++++++++++++++++++++++------------------------ public/js/controllers/MembreCtrl.js | 7 +++---- public/js/controllers/SessionCtrl.js | 17 ++++++++--------- public/js/services/ApiServ.js | 7 +++---- public/js/services/EncryptServ.js | 7 +++---- public/js/services/NotifyServ.js | 7 +++---- public/js/services/SessionServ.js | 7 +++---- 10 files changed, 83 insertions(+), 92 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index c99ded9..5921cc7 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,31 +1,29 @@ -angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl']).config(['$routeProvider', '$locationProvider', - function ($routeProvider, $locationProvider) { - $routeProvider - .when('/', { - templateUrl: 'views/home.html' - }) - .when('/membres', { - templateUrl: 'views/membres.html', - controller: 'MembreCtrl' - }) - .when('/forum', { - redirectTo: 'forum/dir/0' - }) - .when('/forum/dir/:dir_id', { - templateUrl: 'views/forumDir.html', - controller: 'ForumDirCtrl' - }) - .when('/forum/conv/:conv_id', { - templateUrl: 'views/forumConv.html', - controller: 'ForumConvCtrl' - }) - .when('/connect', { - templateUrl: 'views/connect.html', - controller: 'ConnectCtrl' - }) - .otherwise({ - redirectTo: '/' - }); - $locationProvider.html5Mode(true); - } -]); +angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl']).config(function ($routeProvider, $locationProvider) { + $routeProvider + .when('/', { + templateUrl: 'views/home.html' + }) + .when('/membres', { + templateUrl: 'views/membres.html', + controller: 'MembreCtrl' + }) + .when('/forum', { + redirectTo: 'forum/dir/0' + }) + .when('/forum/dir/:dir_id', { + templateUrl: 'views/forumDir.html', + controller: 'ForumDirCtrl' + }) + .when('/forum/conv/:conv_id', { + templateUrl: 'views/forumConv.html', + controller: 'ForumConvCtrl' + }) + .when('/connect', { + templateUrl: 'views/connect.html', + controller: 'ConnectCtrl' + }) + .otherwise({ + redirectTo: '/' + }); + $locationProvider.html5Mode(true); +}); diff --git a/public/js/controllers/ConnectCtrl.js b/public/js/controllers/ConnectCtrl.js index 72ef8a5..89b6366 100644 --- a/public/js/controllers/ConnectCtrl.js +++ b/public/js/controllers/ConnectCtrl.js @@ -1,5 +1,5 @@ -angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']).controller('ConnectCtrl', ['$scope', 'SessionServ', 'EncryptServ', - function ($scope, SessionServ, EncryptServ) { +angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']) + .controller('ConnectCtrl', function ($scope, SessionServ, EncryptServ) { EncryptServ.preload(function () { return undefined; }); @@ -15,5 +15,4 @@ angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']). }); } }; - } -]); + }); diff --git a/public/js/controllers/ForumConvCtrl.js b/public/js/controllers/ForumConvCtrl.js index 48a8148..c2f78d6 100644 --- a/public/js/controllers/ForumConvCtrl.js +++ b/public/js/controllers/ForumConvCtrl.js @@ -1,5 +1,5 @@ -angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']).controller('ForumConvCtrl', ['$scope', '$routeParams', 'SessionServ', 'ApiServ', - function ($scope, $routeParams, SessionServ, ApiServ) { +angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']) + .controller('ForumConvCtrl', function ($scope, $routeParams, SessionServ, ApiServ) { $scope.messs = []; $scope.conv = {}; $scope.formData = {}; @@ -35,5 +35,4 @@ angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']).controller('ForumCo }); }; - } -]); + }); diff --git a/public/js/controllers/ForumDirCtrl.js b/public/js/controllers/ForumDirCtrl.js index d0b243e..ad3ba68 100644 --- a/public/js/controllers/ForumDirCtrl.js +++ b/public/js/controllers/ForumDirCtrl.js @@ -1,31 +1,32 @@ -angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']).controller('ForumDirCtrl', ['$scope', 'SessionServ', 'ApiServ', function ($scope, SessionServ, ApiServ) { - $scope.convs = []; - $scope.formData = {}; +angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) + .controller('ForumDirCtrl', function ($scope, SessionServ, ApiServ) { + $scope.convs = []; + $scope.formData = {}; - $scope.session = SessionServ.cur; - SessionServ.onChange(function () { $scope.session = SessionServ.cur; - }); - - ApiServ("récupération des conversations", 'get', 'convs', function (err, convs) { - if (!err) - $scope.convs = convs; - }); - - $scope.createConv = function () { - ApiServ("création de la conversation", 'post', 'convs', $scope.formData, function (err, conv) { - if (!err) { - $scope.formData = {}; - $scope.convs.push(conv); - } + SessionServ.onChange(function () { + $scope.session = SessionServ.cur; }); - }; - $scope.deleteConv = function (index) { - ApiServ("création de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { + ApiServ("récupération des conversations", 'get', 'convs', function (err, convs) { if (!err) - $scope.convs.splice(index, 1); + $scope.convs = convs; }); - }; -}]); + $scope.createConv = function () { + ApiServ("création de la conversation", 'post', 'convs', $scope.formData, function (err, conv) { + if (!err) { + $scope.formData = {}; + $scope.convs.push(conv); + } + }); + }; + + $scope.deleteConv = function (index) { + ApiServ("création de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { + if (!err) + $scope.convs.splice(index, 1); + }); + }; + + }); diff --git a/public/js/controllers/MembreCtrl.js b/public/js/controllers/MembreCtrl.js index 5987176..16e3bbd 100644 --- a/public/js/controllers/MembreCtrl.js +++ b/public/js/controllers/MembreCtrl.js @@ -1,5 +1,5 @@ -angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']).controller('MembreCtrl', ['$scope', '$http', 'SessionServ', 'ApiServ', - function ($scope, $http, SessionServ, ApiServ) { +angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']) + .controller('MembreCtrl', function ($scope, SessionServ, ApiServ) { $scope.formData = {}; $scope.session = SessionServ.cur; @@ -28,5 +28,4 @@ angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']).controller('MembreCtrl } }); }; - } -]); + }); diff --git a/public/js/controllers/SessionCtrl.js b/public/js/controllers/SessionCtrl.js index 0493fd9..4421e3f 100644 --- a/public/js/controllers/SessionCtrl.js +++ b/public/js/controllers/SessionCtrl.js @@ -1,15 +1,14 @@ -angular.module('SessionsCtrl', ['SessionsServ']).controller('SessionCtrl', ['$scope', 'SessionServ', - function ($scope, SessionServ) { +angular.module('SessionsCtrl', ['SessionsServ']) + .controller('SessionCtrl', function ($scope, SessionServ) { $scope.isCollapsed = false; $scope.session = SessionServ.cur; $scope.disconnect = function () { SessionServ.disconnect(); }; SessionServ.onChange(function () { - $scope.session = SessionServ.cur; - }); - // $scope.$on("$destroy", function () { - // // TODO - // }) - } -]); + $scope.session = SessionServ.cur; + }); + // $scope.$on("$destroy", function () { + // // TODO + // }) + }); diff --git a/public/js/services/ApiServ.js b/public/js/services/ApiServ.js index 2dcd1ec..ea354b4 100644 --- a/public/js/services/ApiServ.js +++ b/public/js/services/ApiServ.js @@ -1,5 +1,5 @@ -angular.module('ApiServ', ['NotifyServ']).service('ApiServ', ['$http', 'NotifyServ', - function ($http, NotifyServ) { +angular.module('ApiServ', ['NotifyServ']) + .service('ApiServ', function ($http, NotifyServ) { return function (name, method, href) { link = '/api/' + href; arglen = arguments.length; @@ -30,5 +30,4 @@ angular.module('ApiServ', ['NotifyServ']).service('ApiServ', ['$http', 'NotifySe // console.error(name, status, data); }); }; - } -]); + }); diff --git a/public/js/services/EncryptServ.js b/public/js/services/EncryptServ.js index ceecd92..92adf2a 100644 --- a/public/js/services/EncryptServ.js +++ b/public/js/services/EncryptServ.js @@ -1,5 +1,5 @@ -angular.module('EncryptServ', []).service('EncryptServ', ['$http', - function ($http) { +angular.module('EncryptServ', []) + .service('EncryptServ', function ($http) { a = { encrypter: false, whenOk: function (cb) { @@ -26,5 +26,4 @@ angular.module('EncryptServ', []).service('EncryptServ', ['$http', } }; return a; - } -]); + }); diff --git a/public/js/services/NotifyServ.js b/public/js/services/NotifyServ.js index a111814..3a4f7a0 100644 --- a/public/js/services/NotifyServ.js +++ b/public/js/services/NotifyServ.js @@ -1,5 +1,5 @@ -angular.module('NotifyServ', []).service('NotifyServ', [ - function () { +angular.module('NotifyServ', []) + .service('NotifyServ', function () { $.notifyDefaults({ placement: { from: 'bottom', @@ -97,5 +97,4 @@ angular.module('NotifyServ', []).service('NotifyServ', [ }; } }; - } -]); + }); diff --git a/public/js/services/SessionServ.js b/public/js/services/SessionServ.js index 319a6ae..e779298 100644 --- a/public/js/services/SessionServ.js +++ b/public/js/services/SessionServ.js @@ -1,5 +1,5 @@ -angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']).service('SessionServ', ['$http', 'EncryptServ', 'NotifyServ', - function ($http, EncryptServ, NotifyServ) { +angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']) + .service('SessionServ', function ($http, EncryptServ, NotifyServ) { a = { cur: false, changeHandlers: [], @@ -74,5 +74,4 @@ angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']).service('SessionSe }; a.get(); return a; - } -]); + }); -- libgit2 0.21.2