37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
/**
|
|
* The image controller
|
|
*
|
|
* @param {$scope} $scope The $scope service from angular
|
|
*/
|
|
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;
|
|
if (image.protected) {
|
|
$scope.data.protected = "true";
|
|
|
|
} else {
|
|
$scope.data.protected = "false";
|
|
}
|
|
$scope.data.name = image.name;
|
|
$scope.data.visibility = image.visibility;
|
|
|
|
$scope.axioms = axioms;
|
|
$('#editImageModal').modal('show');
|
|
});
|
|
|
|
$scope.applyEdition = function (id) {
|
|
Image.updateImage($scope.data, function () {
|
|
$rootScope.$broadcast("updateImageEvent");
|
|
$('#editImageModal').modal('hide');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
$scope.getToken = function () {
|
|
return Identity.getToken();
|
|
}
|
|
}]);
|