summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclient/js/controllers/image/edit.js60
-rwxr-xr-xclient/partials/image/edit.html3
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 = $('<button id="upload_button"/>').text('Upload')
+ .click(function () {
+ $(this).detach();
+ data.submit();
+ });
+ console.log("test");
+ $("#fileupload").after(data.context);
+ },
+ });
+ }
$('#editImageModal').modal('show');
- $("#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 .bar').css(
- 'width',
- progress + '%'
- );
- },
- add: function (e, data) {
- data.process();
- $.each($("#upload_button"), function(){$(this).detach();});
- data.context = $('<button id="upload_button"/>').text('Upload')
- .click(function () {
- $(this).detach();
- data.submit();
- });
- $("#fileupload").after(data.context);
- },
- });
+
});
$scope.applyEdition = function (id) {
diff --git a/client/partials/image/edit.html b/client/partials/image/edit.html
index 667e029..708ce64 100755
--- a/client/partials/image/edit.html
+++ b/client/partials/image/edit.html
@@ -34,12 +34,11 @@
</fieldset>
</form>
- <div ng-if='image.status == "queued"'>
<input id="fileupload" type="file" name="files" size="0" data-url="../server/index.php">
<div id="progress">
+ <div style="width: 100%; float: left"><p id="progress_text" style="text-align: center; width: 100%">0 %</p></div>
<div class="bar" style="width: 0%;"></div>
</div>
- </div>
<!-- <form action="../server/index.php" enctype="multipart/form-data" method="post" ng-if='image.status == "queued"'>
<input type="hidden" name="task" value="image" />
<input type="hidden" name="token" value="{{ getToken()}}" />