From 28cfcece08b3b3c940c69aac936f9d26f7d0d24e Mon Sep 17 00:00:00 2001 From: Eole Date: Tue, 10 May 2016 00:03:41 +0200 Subject: [PATCH] Fin Upload File --- client/js/controllers/image/edit.js | 60 ++++++++++++++++++----------- client/partials/image/edit.html | 3 +- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/client/js/controllers/image/edit.js b/client/js/controllers/image/edit.js index 01dbd18..b95ddd3 100755 --- a/client/js/controllers/image/edit.js +++ b/client/js/controllers/image/edit.js @@ -6,6 +6,8 @@ mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', '$rootScope', function ($scope, Image, Loading, Identity, upload, $rootScope) { $scope.$on('editImageEvent', function (eventName, image, axioms) { + var list = $("#upload_button"); + $.each(list, function(){$(this).detach();}); $scope.image = image; $scope.data = {}; $scope.data.id = image.id; @@ -23,29 +25,43 @@ mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', ' 'width', '0%' ); + if(image.status != "queued"){ + $("#fileupload").css('display','none'); + $("#fileupload").fileupload('destroy'); + $("#fileupload").val(''); + $("#progress").css('display', 'none'); + }else{ + $("#fileupload").val(''); + $("#fileupload").css('display','block'); + $("#progress").css('display', 'block'); + $("#fileupload").fileupload({ + replaceFileInput: false, + formData: {task: "image", token: Identity.getToken(), action: "uploadImage", id: $scope.data.id}, + /* ... */ + progressall: function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + $('#progress_text').html(progress+'%'); + $('#progress .bar').css( + 'width', + progress + '%' + ); + }, + add: function (e, data) { + data.process(); + var list = $("#upload_button"); + $.each(list, function(){$(this).detach();}); + data.context = $('