Commit 20a0d5536cdd2e6e5822daa349f8cc2578a15e0f
1 parent
7cf406d0
Il parait que les dépendances ça sert à rien alors...
Showing
10 changed files
with
83 additions
and
92 deletions
Show diff stats
public/js/app.js
1 | -angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl']).config(['$routeProvider', '$locationProvider', | |
2 | - function ($routeProvider, $locationProvider) { | |
3 | - $routeProvider | |
4 | - .when('/', { | |
5 | - templateUrl: 'views/home.html' | |
6 | - }) | |
7 | - .when('/membres', { | |
8 | - templateUrl: 'views/membres.html', | |
9 | - controller: 'MembreCtrl' | |
10 | - }) | |
11 | - .when('/forum', { | |
12 | - redirectTo: 'forum/dir/0' | |
13 | - }) | |
14 | - .when('/forum/dir/:dir_id', { | |
15 | - templateUrl: 'views/forumDir.html', | |
16 | - controller: 'ForumDirCtrl' | |
17 | - }) | |
18 | - .when('/forum/conv/:conv_id', { | |
19 | - templateUrl: 'views/forumConv.html', | |
20 | - controller: 'ForumConvCtrl' | |
21 | - }) | |
22 | - .when('/connect', { | |
23 | - templateUrl: 'views/connect.html', | |
24 | - controller: 'ConnectCtrl' | |
25 | - }) | |
26 | - .otherwise({ | |
27 | - redirectTo: '/' | |
28 | - }); | |
29 | - $locationProvider.html5Mode(true); | |
30 | - } | |
31 | -]); | |
1 | +angular.module('ciApp', ['ngAnimate', 'ngRoute', 'ConnectCtrl', 'MembreCtrl', 'ForumDirCtrl', 'ForumConvCtrl', 'SessionsCtrl']).config(function ($routeProvider, $locationProvider) { | |
2 | + $routeProvider | |
3 | + .when('/', { | |
4 | + templateUrl: 'views/home.html' | |
5 | + }) | |
6 | + .when('/membres', { | |
7 | + templateUrl: 'views/membres.html', | |
8 | + controller: 'MembreCtrl' | |
9 | + }) | |
10 | + .when('/forum', { | |
11 | + redirectTo: 'forum/dir/0' | |
12 | + }) | |
13 | + .when('/forum/dir/:dir_id', { | |
14 | + templateUrl: 'views/forumDir.html', | |
15 | + controller: 'ForumDirCtrl' | |
16 | + }) | |
17 | + .when('/forum/conv/:conv_id', { | |
18 | + templateUrl: 'views/forumConv.html', | |
19 | + controller: 'ForumConvCtrl' | |
20 | + }) | |
21 | + .when('/connect', { | |
22 | + templateUrl: 'views/connect.html', | |
23 | + controller: 'ConnectCtrl' | |
24 | + }) | |
25 | + .otherwise({ | |
26 | + redirectTo: '/' | |
27 | + }); | |
28 | + $locationProvider.html5Mode(true); | |
29 | +}); | ... | ... |
public/js/controllers/ConnectCtrl.js
1 | -angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']).controller('ConnectCtrl', ['$scope', 'SessionServ', 'EncryptServ', | |
2 | - function ($scope, SessionServ, EncryptServ) { | |
1 | +angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']) | |
2 | + .controller('ConnectCtrl', function ($scope, SessionServ, EncryptServ) { | |
3 | 3 | EncryptServ.preload(function () { |
4 | 4 | return undefined; |
5 | 5 | }); |
... | ... | @@ -15,5 +15,4 @@ angular.module('ConnectCtrl', ['SessionsServ', 'EncryptServ', 'angular-ladda']). |
15 | 15 | }); |
16 | 16 | } |
17 | 17 | }; |
18 | - } | |
19 | -]); | |
18 | + }); | ... | ... |
public/js/controllers/ForumConvCtrl.js
1 | -angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']).controller('ForumConvCtrl', ['$scope', '$routeParams', 'SessionServ', 'ApiServ', | |
2 | - function ($scope, $routeParams, SessionServ, ApiServ) { | |
1 | +angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']) | |
2 | + .controller('ForumConvCtrl', function ($scope, $routeParams, SessionServ, ApiServ) { | |
3 | 3 | $scope.messs = []; |
4 | 4 | $scope.conv = {}; |
5 | 5 | $scope.formData = {}; |
... | ... | @@ -35,5 +35,4 @@ angular.module('ForumConvCtrl', ['SessionsServ', 'ApiServ']).controller('ForumCo |
35 | 35 | }); |
36 | 36 | }; |
37 | 37 | |
38 | - } | |
39 | -]); | |
38 | + }); | ... | ... |
public/js/controllers/ForumDirCtrl.js
1 | -angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']).controller('ForumDirCtrl', ['$scope', 'SessionServ', 'ApiServ', function ($scope, SessionServ, ApiServ) { | |
2 | - $scope.convs = []; | |
3 | - $scope.formData = {}; | |
1 | +angular.module('ForumDirCtrl', ['SessionsServ', 'ApiServ']) | |
2 | + .controller('ForumDirCtrl', function ($scope, SessionServ, ApiServ) { | |
3 | + $scope.convs = []; | |
4 | + $scope.formData = {}; | |
4 | 5 | |
5 | - $scope.session = SessionServ.cur; | |
6 | - SessionServ.onChange(function () { | |
7 | 6 | $scope.session = SessionServ.cur; |
8 | - }); | |
9 | - | |
10 | - ApiServ("récupération des conversations", 'get', 'convs', function (err, convs) { | |
11 | - if (!err) | |
12 | - $scope.convs = convs; | |
13 | - }); | |
14 | - | |
15 | - $scope.createConv = function () { | |
16 | - ApiServ("création de la conversation", 'post', 'convs', $scope.formData, function (err, conv) { | |
17 | - if (!err) { | |
18 | - $scope.formData = {}; | |
19 | - $scope.convs.push(conv); | |
20 | - } | |
7 | + SessionServ.onChange(function () { | |
8 | + $scope.session = SessionServ.cur; | |
21 | 9 | }); |
22 | - }; | |
23 | 10 | |
24 | - $scope.deleteConv = function (index) { | |
25 | - ApiServ("création de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { | |
11 | + ApiServ("récupération des conversations", 'get', 'convs', function (err, convs) { | |
26 | 12 | if (!err) |
27 | - $scope.convs.splice(index, 1); | |
13 | + $scope.convs = convs; | |
28 | 14 | }); |
29 | - }; | |
30 | 15 | |
31 | -}]); | |
16 | + $scope.createConv = function () { | |
17 | + ApiServ("création de la conversation", 'post', 'convs', $scope.formData, function (err, conv) { | |
18 | + if (!err) { | |
19 | + $scope.formData = {}; | |
20 | + $scope.convs.push(conv); | |
21 | + } | |
22 | + }); | |
23 | + }; | |
24 | + | |
25 | + $scope.deleteConv = function (index) { | |
26 | + ApiServ("création de la conversation", 'delete', 'convs', $scope.convs[index]._id, function (err) { | |
27 | + if (!err) | |
28 | + $scope.convs.splice(index, 1); | |
29 | + }); | |
30 | + }; | |
31 | + | |
32 | + }); | ... | ... |
public/js/controllers/MembreCtrl.js
1 | -angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']).controller('MembreCtrl', ['$scope', '$http', 'SessionServ', 'ApiServ', | |
2 | - function ($scope, $http, SessionServ, ApiServ) { | |
1 | +angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']) | |
2 | + .controller('MembreCtrl', function ($scope, SessionServ, ApiServ) { | |
3 | 3 | $scope.formData = {}; |
4 | 4 | |
5 | 5 | $scope.session = SessionServ.cur; |
... | ... | @@ -28,5 +28,4 @@ angular.module('MembreCtrl', ['SessionsServ', 'ApiServ']).controller('MembreCtrl |
28 | 28 | } |
29 | 29 | }); |
30 | 30 | }; |
31 | - } | |
32 | -]); | |
31 | + }); | ... | ... |
public/js/controllers/SessionCtrl.js
1 | -angular.module('SessionsCtrl', ['SessionsServ']).controller('SessionCtrl', ['$scope', 'SessionServ', | |
2 | - function ($scope, SessionServ) { | |
1 | +angular.module('SessionsCtrl', ['SessionsServ']) | |
2 | + .controller('SessionCtrl', function ($scope, SessionServ) { | |
3 | 3 | $scope.isCollapsed = false; |
4 | 4 | $scope.session = SessionServ.cur; |
5 | 5 | $scope.disconnect = function () { |
6 | 6 | SessionServ.disconnect(); |
7 | 7 | }; |
8 | 8 | SessionServ.onChange(function () { |
9 | - $scope.session = SessionServ.cur; | |
10 | - }); | |
11 | - // $scope.$on("$destroy", function () { | |
12 | - // // TODO | |
13 | - // }) | |
14 | - } | |
15 | -]); | |
9 | + $scope.session = SessionServ.cur; | |
10 | + }); | |
11 | + // $scope.$on("$destroy", function () { | |
12 | + // // TODO | |
13 | + // }) | |
14 | + }); | ... | ... |
public/js/services/ApiServ.js
1 | -angular.module('ApiServ', ['NotifyServ']).service('ApiServ', ['$http', 'NotifyServ', | |
2 | - function ($http, NotifyServ) { | |
1 | +angular.module('ApiServ', ['NotifyServ']) | |
2 | + .service('ApiServ', function ($http, NotifyServ) { | |
3 | 3 | return function (name, method, href) { |
4 | 4 | link = '/api/' + href; |
5 | 5 | arglen = arguments.length; |
... | ... | @@ -30,5 +30,4 @@ angular.module('ApiServ', ['NotifyServ']).service('ApiServ', ['$http', 'NotifySe |
30 | 30 | // console.error(name, status, data); |
31 | 31 | }); |
32 | 32 | }; |
33 | - } | |
34 | -]); | |
33 | + }); | ... | ... |
public/js/services/EncryptServ.js
1 | -angular.module('EncryptServ', []).service('EncryptServ', ['$http', | |
2 | - function ($http) { | |
1 | +angular.module('EncryptServ', []) | |
2 | + .service('EncryptServ', function ($http) { | |
3 | 3 | a = { |
4 | 4 | encrypter: false, |
5 | 5 | whenOk: function (cb) { |
... | ... | @@ -26,5 +26,4 @@ angular.module('EncryptServ', []).service('EncryptServ', ['$http', |
26 | 26 | } |
27 | 27 | }; |
28 | 28 | return a; |
29 | - } | |
30 | -]); | |
29 | + }); | ... | ... |
public/js/services/NotifyServ.js
1 | -angular.module('NotifyServ', []).service('NotifyServ', [ | |
2 | - function () { | |
1 | +angular.module('NotifyServ', []) | |
2 | + .service('NotifyServ', function () { | |
3 | 3 | $.notifyDefaults({ |
4 | 4 | placement: { |
5 | 5 | from: 'bottom', |
... | ... | @@ -97,5 +97,4 @@ angular.module('NotifyServ', []).service('NotifyServ', [ |
97 | 97 | }; |
98 | 98 | } |
99 | 99 | }; |
100 | - } | |
101 | -]); | |
100 | + }); | ... | ... |
public/js/services/SessionServ.js
1 | -angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']).service('SessionServ', ['$http', 'EncryptServ', 'NotifyServ', | |
2 | - function ($http, EncryptServ, NotifyServ) { | |
1 | +angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']) | |
2 | + .service('SessionServ', function ($http, EncryptServ, NotifyServ) { | |
3 | 3 | a = { |
4 | 4 | cur: false, |
5 | 5 | changeHandlers: [], |
... | ... | @@ -74,5 +74,4 @@ angular.module('SessionsServ', ['NotifyServ', 'EncryptServ']).service('SessionSe |
74 | 74 | }; |
75 | 75 | a.get(); |
76 | 76 | return a; |
77 | - } | |
78 | -]); | |
77 | + }); | ... | ... |