diff --git a/docs-web/src/main/webapp/src/app/share/controller/Share.js b/docs-web/src/main/webapp/src/app/share/controller/Share.js index c85f65c8..981aea98 100644 --- a/docs-web/src/main/webapp/src/app/share/controller/Share.js +++ b/docs-web/src/main/webapp/src/app/share/controller/Share.js @@ -3,7 +3,7 @@ /** * Share controller. */ -angular.module('share').controller('Share', function($scope, $state, $stateParams, Restangular) { +angular.module('share').controller('Share', function($scope, $state, $stateParams, Restangular, $modal) { // Load document Restangular.one('document', $stateParams.documentId).get({ share: $stateParams.shareId }) .then(function (data) { @@ -33,4 +33,16 @@ angular.module('share').controller('Share', function($scope, $state, $stateParam $scope.openFile = function (file) { $state.go('share.file', { documentId: $stateParams.documentId, shareId: $stateParams.shareId, fileId: file.id }) }; + + /** + * Export the current document to PDF. + */ + $scope.exportPdf = function() { + $modal.open({ + templateUrl: 'partial/share/share.pdf.html', + controller: 'ShareModalPdf' + }); + + return false; + }; }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/app/share/controller/ShareModalPdf.js b/docs-web/src/main/webapp/src/app/share/controller/ShareModalPdf.js new file mode 100644 index 00000000..ff6b2cd9 --- /dev/null +++ b/docs-web/src/main/webapp/src/app/share/controller/ShareModalPdf.js @@ -0,0 +1,30 @@ +'use strict'; + +/** + * Document modal PDF controller. + */ +angular.module('share').controller('ShareModalPdf', function ($scope, $window, $stateParams, $modalInstance) { + $scope.export = { + metadata: false, + comments: false, + fitimagetopage: true, + margin: 10 + }; + + // Export to PDF + $scope.exportPdf = function() { + $window.open('../api/document/' + $stateParams.documentId + + '/pdf?metadata=' + $scope.export.metadata + + '&comments=' + $scope.export.comments + + '&fitimagetopage=' + $scope.export.fitimagetopage + + '&margin=' + $scope.export.margin + + '&share=' + $stateParams.shareId); + + $modalInstance.close(); + }; + + // Close the modal + $scope.close = function () { + $modalInstance.close(); + } +}); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/partial/share/share.html b/docs-web/src/main/webapp/src/partial/share/share.html index d03fe326..1f1e1d26 100644 --- a/docs-web/src/main/webapp/src/partial/share/share.html +++ b/docs-web/src/main/webapp/src/partial/share/share.html @@ -1,11 +1,32 @@
+
+ +
+