mirror of
https://github.com/wekan/wekan.git
synced 2026-01-31 05:35:16 +01:00
board export now checks authentication
This commit is contained in:
parent
7cfc72da99
commit
18697d45f6
6 changed files with 52 additions and 21 deletions
|
|
@ -56,7 +56,7 @@ template(name="boardMenuPopup")
|
|||
if currentUser.isBoardAdmin
|
||||
hr
|
||||
ul.pop-over-list
|
||||
li: a.js-export-board(href="{{urlExport}}", download) {{_ 'export-board'}}
|
||||
li: a.js-export-board {{_ 'export-board'}}
|
||||
li: a.js-archive-board {{_ 'archive-board'}}
|
||||
|
||||
template(name="boardVisibilityList")
|
||||
|
|
|
|||
|
|
@ -13,6 +13,20 @@ 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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue