From 2957034286dfe1e51ab045daa436b45427b932a5 Mon Sep 17 00:00:00 2001 From: bgamard Date: Thu, 9 Nov 2017 14:39:25 +0100 Subject: [PATCH] Closes #147: fix IE file upload --- .../docs/controller/document/DocumentEdit.js | 2 +- .../controller/settings/SettingsConfig.js | 2 +- .../webapp/src/app/docs/directive/File.js | 20 ------------------- docs-web/src/main/webapp/src/index.html | 1 - .../src/partial/docs/document.edit.html | 4 ++-- .../partial/docs/document.view.content.html | 17 ++++++++-------- .../src/partial/docs/settings.config.html | 6 +++--- docs-web/src/main/webapp/src/style/main.less | 1 + 8 files changed, 16 insertions(+), 37 deletions(-) delete mode 100644 docs-web/src/main/webapp/src/app/docs/directive/File.js diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js index a7ec2e48..65e19ea5 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentEdit.js @@ -148,7 +148,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $ var file = $scope.newFiles[key]; var formData = new FormData(); formData.append('id', data.id); - formData.append('file', file); + formData.append('file', file, file.name); // Send the file $.ajax({ diff --git a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js index 2c533851..5e0532d5 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsConfig.js @@ -39,7 +39,7 @@ angular.module('docs').controller('SettingsConfig', function($scope, $rootScope, $scope.sendImage = function(type, image) { // Build the payload var formData = new FormData(); - formData.append('image', image); + formData.append('image', image[0]); // Send the file var done = function() { diff --git a/docs-web/src/main/webapp/src/app/docs/directive/File.js b/docs-web/src/main/webapp/src/app/docs/directive/File.js deleted file mode 100644 index 9e0b0be7..00000000 --- a/docs-web/src/main/webapp/src/app/docs/directive/File.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -/** - * File upload directive. - */ -angular.module('docs').directive('file', function() { - return { - restrict: 'E', - template: '', - replace: true, - require: 'ngModel', - link: function(scope, element, attrs, ctrl) { - element.bind('change', function() { - scope.$apply(function() { - attrs.multiple ? ctrl.$setViewValue(element[0].files) : ctrl.$setViewValue(element[0].files[0]); - }); - }); - } - } -}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/index.html b/docs-web/src/main/webapp/src/index.html index 42c0ae2f..82c7d25f 100644 --- a/docs-web/src/main/webapp/src/index.html +++ b/docs-web/src/main/webapp/src/index.html @@ -79,7 +79,6 @@ - diff --git a/docs-web/src/main/webapp/src/partial/docs/document.edit.html b/docs-web/src/main/webapp/src/partial/docs/document.edit.html index 70ed9d04..a450cdff 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.edit.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.edit.html @@ -70,12 +70,12 @@
- +
+ {{ orphanFiles.length }} file{{ orphanFiles.length > 1 ? 's' : '' }} {{ 'document.edit.orphan_files' | translate: '{ count: orphanFiles.length }' }} -
{{newFiles}} +
diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html index c7afc320..5821da00 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html @@ -72,16 +72,15 @@ {{ 'document.view.content.drop_zone' | translate }}

+
-
-
- -
+
+
diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.config.html b/docs-web/src/main/webapp/src/partial/docs/settings.config.html index 60f6ce24..fac842b1 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.config.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.config.html @@ -40,7 +40,7 @@
-
@@ -54,8 +54,8 @@
-