Commit a9a5cb2ac2b209ba6d298da94f48680201235e3c

Authored by Geoffrey PREUD'HOMME
1 parent 823ab614

Possibilité cliente de réordonner la liste des membres

bower.json
1 1 {
2   - "name": "ci-site",
3   - "version": "0.0.1",
4   - "dependencies": {
5   - "angular": "~1.3.15",
6   - "angular-animate": "~1.3.15",
7   - "angular-ladda": "~0.2.2",
8   - "angular-route": "~1.3.15",
9   - "animate.css": "~3.2.6",
10   - "bootswatch-dist": "3.3.4-cerulean",
11   - "jsencrypt": "~2.1.0",
12   - "remarkable-bootstrap-notify": "~3.0.2"
13   - }
  2 + "name": "ci-site",
  3 + "version": "0.0.1",
  4 + "dependencies": {
  5 + "angular": "~1.3.15",
  6 + "angular-animate": "~1.3.15",
  7 + "angular-ladda": "~0.2.2",
  8 + "angular-route": "~1.3.15",
  9 + "animate.css": "~3.2.6",
  10 + "bootswatch-dist": "3.3.4-cerulean",
  11 + "jsencrypt": "~2.1.0",
  12 + "remarkable-bootstrap-notify": "~3.0.2",
  13 + "ng-sortable": "~1.2.0"
  14 + }
14 15 }
... ...
public/js/controllers/MembreCtrl.js
1   -angular.module('MembreCtrl', ['SessionsServ', 'ApiServ'])
  1 +angular.module('MembreCtrl', ['SessionsServ', 'ApiServ', 'ui.sortable'])
2 2 .controller('MembreCtrl', function ($scope, SessionServ, ApiServ) {
  3 + $scope.membres = [];
3 4 $scope.formData = {};
4 5  
5 6 $scope.session = SessionServ.cur;
... ... @@ -12,6 +13,12 @@ angular.module('MembreCtrl', ['SessionsServ', 'ApiServ'])
12 13 $scope.membres = membres;
13 14 });
14 15  
  16 + // $scope.dragControlListeners = {
  17 + // orderChanged: function (e) {
  18 + // console.log('Swap', e.source.index, e.dest.index);
  19 + // }
  20 + // };
  21 +
15 22 $scope.createMembre = function () {
16 23 ApiServ("création du membre", 'post', 'membres', $scope.formData, function (err, membre) {
17 24 if (!err) {
... ...
public/views/index.html
... ... @@ -9,7 +9,7 @@
9 9 <link rel="stylesheet" href="libs/bootswatch-dist/css/bootstrap.min.css">
10 10 <link rel="stylesheet" href="css/style.css">
11 11 <link rel="stylesheet" href="libs/animate.css/animate.min.css">
12   - <link rel="stylesheet" href="libs/ladda/dist/ladda-themeless.min.css">
  12 + <link rel="stylesheet" href="libs/ng-sortable/dist/ng-sortable.min.css">
13 13 <script src="libs/jquery/dist/jquery.min.js"></script>
14 14 <script src="libs/angular/angular.min.js"></script>
15 15 <script src="libs/angular-route/angular-route.min.js"></script>
... ... @@ -19,6 +19,7 @@
19 19 <script src="libs/ladda/js/spin.js"></script>
20 20 <script src="libs/ladda/js/ladda.js"></script>
21 21 <script src="libs/angular-ladda/dist/angular-ladda.min.js"></script>
  22 + <script src="libs/ng-sortable/dist/ng-sortable.min.js"></script>
22 23 <script src="js/services/NotifyServ.js"></script>
23 24 <script src="js/services/ApiServ.js"></script>
24 25 <script src="js/services/EncryptServ.js"></script>
... ... @@ -62,4 +63,4 @@
62 63 </div>
63 64 </body>
64 65  
65 66 -</html>
  67 +</html>
66 68 \ No newline at end of file
... ...
public/views/membres.html
... ... @@ -13,12 +13,15 @@
13 13 <th ng-if="session.canAddMembre || session.canDelMembre">Action</th>
14 14 </tr>
15 15 </thead>
16   - <tbody ng-repeat="membre in membres">
17   - <tr>
  16 + <tbody data-as-sortable="dragControlListeners" data-ng-model="membres">
  17 + <tr data-ng-repeat="membre in membres" data-as-sortable-item>
18 18 <td>{{ membre.nom }}</td>
19 19 <td>{{ membre.section }}</td>
20 20 <td>{{ membre.role }}</td>
21 21 <td ng-if="session.canDelMembre">
  22 + <button type="button" class="btn btn-default" aria-label="Déplacer" data-as-sortable-item-handle>
  23 + <span class="glyphicon glyphicon-resize-vertical" aria-hidden="true"></span>
  24 + </button>
22 25 <button type="button" class="btn btn-danger" aria-label="Expulser" ng-click="deleteMembre($index)">
23 26 <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
24 27 </button>
... ... @@ -43,4 +46,4 @@
43 46 </tr>
44 47 </tfoot>
45 48 </table>
46 49 -</div>
  50 +</div>
47 51 \ No newline at end of file
... ...