mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
Closes #147: fix IE file upload
This commit is contained in:
parent
36b4fbd303
commit
2957034286
@ -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({
|
||||
|
@ -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() {
|
||||
|
@ -1,20 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* File upload directive.
|
||||
*/
|
||||
angular.module('docs').directive('file', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<input type="file" />',
|
||||
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]);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -79,7 +79,6 @@
|
||||
<script src="app/docs/service/User.js" type="text/javascript"></script>
|
||||
<script src="app/docs/filter/Newline.js" type="text/javascript"></script>
|
||||
<script src="app/docs/filter/Filesize.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/File.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/SelectTag.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/SelectRelation.js" type="text/javascript"></script>
|
||||
<script src="app/docs/directive/AuditLog.js" type="text/javascript"></script>
|
||||
|
@ -70,12 +70,12 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inputFiles">{{ 'document.edit.new_files' | translate }}</label>
|
||||
<div class="col-sm-6">
|
||||
<file class="form-control" id="inputFiles" multiple="multiple" ng-model="newFiles" ng-disabled="fileIsUploading"></file>
|
||||
<input type="file" ng-file-select class="form-control" id="inputFiles" multiple="multiple" ng-model="newFiles" ng-disabled="fileIsUploading"></input>
|
||||
</div>
|
||||
<div class="col-sm-4" ng-if="orphanFiles.length > 0">
|
||||
+ {{ orphanFiles.length }} file{{ orphanFiles.length > 1 ? 's' : '' }}
|
||||
{{ 'document.edit.orphan_files' | translate: '{ count: orphanFiles.length }' }}
|
||||
</div>{{newFiles}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inputTags">{{ 'document.tags' | translate }}</label>
|
||||
|
@ -72,8 +72,8 @@
|
||||
<span class="glyphicon glyphicon-move"></span>
|
||||
{{ 'document.view.content.drop_zone' | translate }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" ng-file-select
|
||||
ng-file-change="fileDropped($files, $event)"
|
||||
@ -83,6 +83,5 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ui-view="file"></div>
|
@ -40,7 +40,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inputLogo">{{ 'settings.config.logo' | translate }}</label>
|
||||
<div class="col-sm-2">
|
||||
<file accept="image/gif,image/png,image/jpg,image/jpeg"
|
||||
<input type="file" ng-file-select accept="image/gif,image/png,image/jpg,image/jpeg"
|
||||
class="form-control" id="inputLogo" ng-model="logo" ng-disabled="sendingImage" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
@ -54,8 +54,8 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="inputBackground">{{ 'settings.config.background_image' | translate }}</label>
|
||||
<div class="col-sm-2">
|
||||
<file accept="image/gif,image/png,image/jpg,image/jpeg"
|
||||
class="form-control" id="inputLogo" ng-model="background" ng-disabled="sendingImage" />
|
||||
<input type="file" ng-file-select accept="image/gif,image/png,image/jpg,image/jpeg"
|
||||
class="form-control" id="inputBackground" ng-model="background" ng-disabled="sendingImage" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-default" ng-click="sendImage('background', background)" ng-disabled="sendingImage || !background">
|
||||
|
@ -268,6 +268,7 @@ input[readonly].share-link {
|
||||
// Vertical alignment
|
||||
.vertical-center {
|
||||
min-height: 100vh;
|
||||
height: 100vh; /* IE fix */
|
||||
|
||||
/* Make it a flex container */
|
||||
display: -webkit-box;
|
||||
|
Loading…
Reference in New Issue
Block a user