From ae4e0282310b3ab3fe1d92b24b857bf56ceda09a Mon Sep 17 00:00:00 2001 From: Loic GUEGAN Date: Sun, 17 Apr 2016 20:43:41 +0200 Subject: [PATCH] Add functionnality --- client/index.html | 3 ++ client/js/controllers/image/edit.js | 13 ++++++ client/js/controllers/image/image.js | 7 +++- client/partials/image/edit.html | 60 ++++++++-------------------- client/partials/image/image.html | 4 +- 5 files changed, 41 insertions(+), 46 deletions(-) create mode 100644 client/js/controllers/image/edit.js diff --git a/client/index.html b/client/index.html index 45bee7f..d941857 100644 --- a/client/index.html +++ b/client/index.html @@ -24,6 +24,7 @@
+
@@ -93,6 +94,8 @@ + + diff --git a/client/js/controllers/image/edit.js b/client/js/controllers/image/edit.js new file mode 100644 index 0000000..3635e21 --- /dev/null +++ b/client/js/controllers/image/edit.js @@ -0,0 +1,13 @@ +/** + * The image controller + * + * @param {$scope} $scope The $scope service from angular + */ +mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', function ($scope, Image, Loading, Identity, upload) + { + $scope.$on('editImageEvent', function (eventName, image) { + $scope.image = image; + $('#editImageModal').modal('show'); + console.log(image) + }); + }]); diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index d0578d7..b74dc76 100644 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -3,7 +3,7 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', function ($scope, Image, Loading, Identity) +mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity','$rootScope', function ($scope, Image, Loading, Identity, $rootScope) { // Update view @@ -21,4 +21,9 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', funct callMeAfterGetImage(); } } + + $scope.edit=function(image){ + $rootScope.$broadcast("editImageEvent", image); + + } }]); diff --git a/client/partials/image/edit.html b/client/partials/image/edit.html index be96051..de7b5a0 100644 --- a/client/partials/image/edit.html +++ b/client/partials/image/edit.html @@ -1,4 +1,4 @@ - diff --git a/client/partials/image/image.html b/client/partials/image/image.html index 43f1855..9c17c2f 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -8,7 +8,7 @@
- +

@@ -25,7 +25,7 @@ {{ image.name}} {{ (image.size / 1048576).toFixed(2)}} MB - +