summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorXavier Priour <xavier.priour@bubblyware.com>2015-12-16 21:54:35 +0100
committerXavier Priour <xavier.priour@bubblyware.com>2015-12-16 21:58:43 +0100
commitd08e1cc45b7f894f360f3a8a89e235ccc47b8f96 (patch)
treec6e38bc7e4f25a7185d787191a34959ce673b1a4 /client
parentefe7c21d579a0cffe682741d2daf832062001a3a (diff)
downloadwekan-d08e1cc45b7f894f360f3a8a89e235ccc47b8f96.tar.gz
wekan-d08e1cc45b7f894f360f3a8a89e235ccc47b8f96.tar.bz2
wekan-d08e1cc45b7f894f360f3a8a89e235ccc47b8f96.zip
Export Wekan now server-based with proper auth
Diffstat (limited to 'client')
-rw-r--r--client/components/boards/boardHeader.jade2
-rw-r--r--client/components/boards/boardHeader.js26
2 files changed, 10 insertions, 18 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade
index eb7ca984..a743311b 100644
--- a/client/components/boards/boardHeader.jade
+++ b/client/components/boards/boardHeader.jade
@@ -56,7 +56,7 @@ template(name="boardMenuPopup")
if currentUser.isBoardAdmin
hr
ul.pop-over-list
- li: a.js-export-board {{_ 'export-board'}}
+ li: a(href="{{exportUrl}}", download="{{exportFilename}}") {{_ 'export-board'}}
li: a.js-archive-board {{_ 'archive-board'}}
template(name="boardVisibilityList")
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index b5bb0dbb..0c9b5794 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -1,4 +1,3 @@
-/* global saveAs */
Template.boardMenuPopup.events({
'click .js-rename-board': Popup.open('boardChangeTitle'),
'click .js-open-archives'() {
@@ -14,25 +13,18 @@ Template.boardMenuPopup.events({
// confirm that the board was successfully archived.
FlowRouter.go('home');
}),
- 'click .js-export-board'() {
- const boardId = Session.get('currentBoard');
- Meteor.call('exportBoard', boardId, (error, response) => {
- if(error) {
- // the only error we can anticipate is accessing a non-authorized board
- // and this should have been caugh by UI before.
- // So no treatment here for the time being.
- } else {
- const dataToSave = new Blob([JSON.stringify(response)], {type: 'application/json;charset=utf-8'});
- const filename = `wekan-export-board-${boardId}.json`;
- saveAs(dataToSave, filename);
- }
- });
- },
});
Template.boardMenuPopup.helpers({
- urlExport() {
- return Meteor.absoluteUrl(`api/b/${Session.get('currentBoard')}`);
+ exportUrl() {
+ const boardId = Session.get('currentBoard');
+ const userId = Meteor.userId();
+ const loginToken = Accounts._storedLoginToken();
+ return Meteor.absoluteUrl(`api/b/${boardId}/${userId}/${loginToken}`);
+ },
+ exportFilename() {
+ const boardId = Session.get('currentBoard');
+ return `wekan-export-board-${boardId}.json`;
},
});