diff options
Diffstat (limited to 'client/components')
-rw-r--r-- | client/components/boards/boardHeader.jade | 1 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index fc1abc88..eb7ca984 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -56,6 +56,7 @@ template(name="boardMenuPopup") if currentUser.isBoardAdmin hr ul.pop-over-list + li: a.js-export-board {{_ '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 9423ecee..b5bb0dbb 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -1,3 +1,4 @@ +/* global saveAs */ Template.boardMenuPopup.events({ 'click .js-rename-board': Popup.open('boardChangeTitle'), 'click .js-open-archives'() { @@ -13,6 +14,26 @@ 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')}`); + }, }); Template.boardChangeTitlePopup.events({ |