istic-openstack/client/js/controllers/image/edit.js

35 lines
1 KiB
JavaScript
Raw Normal View History

2016-04-17 20:43:41 +02:00
/**
* The image controller
*
* @param {$scope} $scope The $scope service from angular
*/
2016-05-08 15:49:21 +02:00
mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', '$rootScope', function ($scope, Image, Loading, Identity, upload, $rootScope)
2016-04-17 20:43:41 +02:00
{
2016-04-20 09:10:02 +02:00
$scope.$on('editImageEvent', function (eventName, image, axioms) {
2016-04-17 20:43:41 +02:00
$scope.image = image;
2016-05-08 15:49:21 +02:00
$scope.data = {};
$scope.data.id = image.id;
$scope.data.name = image.name;
$scope.data.visibility = image.visibility;
$scope.data.protected = image.protected;
2016-04-20 09:10:02 +02:00
$scope.axioms = axioms;
2016-04-17 20:43:41 +02:00
$('#editImageModal').modal('show');
});
2016-04-20 09:10:02 +02:00
$scope.data = {};
2016-05-08 15:49:21 +02:00
$scope.applyEdition = function (id) {
Image.updateImage($scope.data, function () {
$rootScope.$broadcast("updateImageEvent");
$('#editImageModal').modal('hide');
});
2016-04-20 09:10:02 +02:00
};
2016-05-08 15:49:21 +02:00
$scope.getToken = function () {
2016-05-07 10:52:22 +02:00
return Identity.getToken();
}
2016-04-17 20:43:41 +02:00
}]);