client/app/gallery/gallery_controller.js
author cavaliet
Mon, 06 Oct 2014 17:36:47 +0200
changeset 7 e70f1c4785f3
parent 5 c6ff29914983
child 10 75189d83f849
permissions -rw-r--r--
search with new results
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
(function(){
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
  'use strict';
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
  angular.module('ammicoGallery',['ngResource', 'ngRoute'])
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
    .config(function ($routeProvider) {
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
      $routeProvider
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
        .when('/', {
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
          templateUrl: 'gallery/gallery.html',
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
          controller: 'galleryCtrl'
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
        });
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    })
3
18a4c598ddee common data for gallery and slideshow
cavaliet
parents: 1
diff changeset
    12
    .controller('galleryCtrl', function($scope, $location, slideshowModel){
18a4c598ddee common data for gallery and slideshow
cavaliet
parents: 1
diff changeset
    13
      console.log('gallery 5',$scope, $location, slideshowModel);
18a4c598ddee common data for gallery and slideshow
cavaliet
parents: 1
diff changeset
    14
      $scope.gallery = slideshowModel.slideshow;
5
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    15
      
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    16
      $scope.deleteItem = function(i){
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    17
          if(0<=i && i<$scope.gallery.images.length){
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    18
              if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    19
                  $scope.gallery.images.splice(i, 1);
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    20
              }
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    21
          }
c6ff29914983 delete item from gallery
cavaliet
parents: 3
diff changeset
    22
      };
0
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
    });
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
})();