1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-22 14:11:39 +00:00

Closes #208: display file content + fix filename encoding

This commit is contained in:
Benjamin Gamard
2018-03-23 16:41:02 +01:00
parent 55a4bb7621
commit be1c2a7b90
10 changed files with 53 additions and 12 deletions

View File

@@ -153,7 +153,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, file.name);
formData.append('file', file, encodeURIComponent(file.name));
// Send the file
$.ajax({

View File

@@ -70,6 +70,13 @@ angular.module('docs').controller('FileModalView', function ($uibModalInstance,
window.open('../api/file/' + $stateParams.fileId + '/data');
};
/**
* Open the file content a new window.
*/
$scope.openFileContent = function () {
window.open('../api/file/' + $stateParams.fileId + '/data?size=content');
};
/**
* Print the file.
*/

View File

@@ -1,4 +1,8 @@
/**!
* =======================================================================
* Sismics Docs patch applied to encode filenames with encodeURIComponent.
* =======================================================================
*
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <danial.farid@gmail.com>
@@ -272,7 +276,7 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
key = split[0];
}
config._fileKey = config._fileKey || key;
formData.append(key, file, file.ngfName || file.name);
formData.append(key, file, file.ngfName || encodeURIComponent(file.name));
} else {
if (angular.isObject(val)) {
if (val.$$ngfCircularDetection) throw 'ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: ' + key;

View File

@@ -60,7 +60,7 @@
<div class="btn btn-default handle"><span class="fas fa-arrows-alt-h"></span></div>
</div>
<div class="v-align">
<div class="v-align" ng-show="document.writable">
<div uib-dropdown>
<button class="btn btn-default" uib-dropdown-toggle>
<span class="fas fa-ellipsis-v"></span>

View File

@@ -22,12 +22,15 @@
</div>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default" ng-click="printFile()">
<button type="button" class="btn btn-default" uib-tooltip="Print this file" tooltip-append-to-body="true" ng-click="printFile()">
<span class="fas fa-print"></span>
</button>
<button type="button" class="btn btn-default" ng-click="openFile()">
<button type="button" class="btn btn-default" uib-tooltip="Download this file" tooltip-append-to-body="true" ng-click="openFile()">
<span class="fas fa-download"></span>
</button>
<button type="button" class="btn btn-default" uib-tooltip="Show text content" tooltip-append-to-body="true" ng-click="openFileContent()">
<span class="fas fa-eye"></span>
</button>
</div>
</div>

View File

@@ -429,6 +429,8 @@ input[readonly].share-link {
}
.settings-content {
margin-bottom: 10px;
.well {
box-shadow: 0 7px 14px 0 rgba(50,50,93,.1), 0 3px 6px 0 rgba(0,0,0,.07);
background: none;