Add image name edition

This commit is contained in:
Loic GUEGAN 2016-05-08 15:49:21 +02:00
parent c5e909da1b
commit 19d62a8cbf
3 changed files with 25 additions and 13 deletions

View file

@ -3,25 +3,33 @@
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', function ($scope, Image, Loading, Identity, upload)
mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', '$rootScope', function ($scope, Image, Loading, Identity, upload, $rootScope)
{
$scope.$on('editImageEvent', function (eventName, image, axioms) {
$scope.image = image;
$scope.data = {};
$scope.data.id = image.id;
$scope.data.name = image.name;
$scope.data.visibility = image.visibility;
$scope.data.protected = image.protected;
$scope.axioms = axioms;
$('#editImageModal').modal('show');
});
$scope.data = {};
$scope.data.visibility = "public";
$scope.data.protected = false;
$scope.applyEdition = function (image) {
image.visibility = $scope.data.visibility;
image.protected = $scope.data.protected;
Image.updateImage(image, function(){});
$scope.applyEdition = function (id) {
Image.updateImage($scope.data, function () {
$rootScope.$broadcast("updateImageEvent");
$('#editImageModal').modal('hide');
});
};
$scope.getToken=function(){
$scope.getToken = function () {
return Identity.getToken();
}
}]);