diff options
| author | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-27 17:03:29 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-27 17:03:29 +0200 |
| commit | 9a93133272efc239368252bbf4e0eee1791fd911 (patch) | |
| tree | b6e1a94cd103bf5c33e3e735d72f463cfe56950b /client/js/services | |
| parent | 3c72415dcda4ca43a2adf9a0254d51cc6ce196c3 (diff) | |
| parent | 1cdc04c5f10d57e56a049481d53c3f1006229fcb (diff) | |
Merge branch 'loic-image-edition' into loic
Diffstat (limited to 'client/js/services')
| -rw-r--r-- | client/js/services/Image.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/client/js/services/Image.js b/client/js/services/Image.js index 795f85e..90f3a48 100644 --- a/client/js/services/Image.js +++ b/client/js/services/Image.js @@ -4,7 +4,9 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) { // Data object var data = {}; data.images = null; // Images - + data.axioms = {}; + data.axioms.protected = [true, false]; + data.axioms.visibility = ["public", "private"]; /** * Parse uploadImage anwser * @param {type} response @@ -54,6 +56,28 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) { }; /** + * Update image + * @param {type} image + * @param {type} callback + * @returns {undefined} + */ + var updateImage = function (image, callback) { + var result = $http.post('../server/index.php', + $.param({"token": Identity.getToken(), "task": "image", 'action': 'updateImage', 'id': image.id, 'opt': image})); + + // Wait and handle the response + result.then(function (response) { + callback(); + }, function (response) { + alert(response) + }); + + + }; + + + + /** * Upload an image * @param {type} fileToUpload * @param {type} callback @@ -106,6 +130,7 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) { // Return services objects return { getImages: getImages, + updateImage: updateImage, getData: getData, uploadImage: uploadImage }; |
