mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Remove export button if WITH_API is not enabled
#2938 https://github.com/wekan/wekan/issues/2938#issuecomment-589782402
This commit is contained in:
parent
7c25542976
commit
f09219cbfd
4 changed files with 34 additions and 29 deletions
|
|
@ -33,22 +33,6 @@ Template.boardMenuPopup.events({
|
||||||
'click .js-card-settings': Popup.open('boardCardSettings'),
|
'click .js-card-settings': Popup.open('boardCardSettings'),
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.boardMenuPopup.helpers({
|
|
||||||
exportUrl() {
|
|
||||||
const params = {
|
|
||||||
boardId: Session.get('currentBoard'),
|
|
||||||
};
|
|
||||||
const queryParams = {
|
|
||||||
authToken: Accounts._storedLoginToken(),
|
|
||||||
};
|
|
||||||
return FlowRouter.path('/api/boards/:boardId/export', params, queryParams);
|
|
||||||
},
|
|
||||||
exportFilename() {
|
|
||||||
const boardId = Session.get('currentBoard');
|
|
||||||
return `wekan-export-board-${boardId}.json`;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.boardChangeTitlePopup.events({
|
Template.boardChangeTitlePopup.events({
|
||||||
submit(event, templateInstance) {
|
submit(event, templateInstance) {
|
||||||
const newTitle = templateInstance
|
const newTitle = templateInstance
|
||||||
|
|
|
||||||
|
|
@ -298,10 +298,11 @@ template(name="boardMenuPopup")
|
||||||
if currentUser.isBoardAdmin
|
if currentUser.isBoardAdmin
|
||||||
hr
|
hr
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
li
|
if withApi
|
||||||
a(href="{{exportUrl}}", download="{{exportFilename}}")
|
li
|
||||||
i.fa.fa-share-alt
|
a(href="{{exportUrl}}", download="{{exportFilename}}")
|
||||||
| {{_ 'export-board'}}
|
i.fa.fa-share-alt
|
||||||
|
| {{_ 'export-board'}}
|
||||||
li
|
li
|
||||||
a.js-outgoing-webhooks
|
a.js-outgoing-webhooks
|
||||||
i.fa.fa-globe
|
i.fa.fa-globe
|
||||||
|
|
@ -326,11 +327,12 @@ template(name="boardMenuPopup")
|
||||||
if isSandstorm
|
if isSandstorm
|
||||||
hr
|
hr
|
||||||
ul.pop-over-list
|
ul.pop-over-list
|
||||||
li
|
if withApi
|
||||||
a(href="{{exportUrl}}", download="{{exportFilename}}")
|
li
|
||||||
i.fa.fa-share-alt
|
a(href="{{exportUrl}}", download="{{exportFilename}}")
|
||||||
i.fa.fa-sign-out
|
i.fa.fa-share-alt
|
||||||
| {{_ 'export-board'}}
|
i.fa.fa-sign-out
|
||||||
|
| {{_ 'export-board'}}
|
||||||
li
|
li
|
||||||
a.js-import-board
|
a.js-import-board
|
||||||
i.fa.fa-share-alt
|
i.fa.fa-share-alt
|
||||||
|
|
|
||||||
|
|
@ -196,14 +196,14 @@ Template.boardMenuPopup.events({
|
||||||
},
|
},
|
||||||
'click .js-change-board-color': Popup.open('boardChangeColor'),
|
'click .js-change-board-color': Popup.open('boardChangeColor'),
|
||||||
'click .js-change-language': Popup.open('changeLanguage'),
|
'click .js-change-language': Popup.open('changeLanguage'),
|
||||||
'click .js-archive-board ': Popup.afterConfirm('archiveBoard', function() {
|
'click .js-archive-board ': Popup.afterConfirm('archiveBoard', function () {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
currentBoard.archive();
|
currentBoard.archive();
|
||||||
// XXX We should have some kind of notification on top of the page to
|
// XXX We should have some kind of notification on top of the page to
|
||||||
// confirm that the board was successfully archived.
|
// confirm that the board was successfully archived.
|
||||||
FlowRouter.go('home');
|
FlowRouter.go('home');
|
||||||
}),
|
}),
|
||||||
'click .js-delete-board': Popup.afterConfirm('deleteBoard', function() {
|
'click .js-delete-board': Popup.afterConfirm('deleteBoard', function () {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
Popup.close();
|
Popup.close();
|
||||||
Boards.remove(currentBoard._id);
|
Boards.remove(currentBoard._id);
|
||||||
|
|
@ -215,7 +215,18 @@ Template.boardMenuPopup.events({
|
||||||
'click .js-card-settings': Popup.open('boardCardSettings'),
|
'click .js-card-settings': Popup.open('boardCardSettings'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Template.boardMenuPopup.onCreated(function () {
|
||||||
|
this.apiEnabled = new ReactiveVar(false);
|
||||||
|
Meteor.call('_isApiEnabled', (e, result) => {
|
||||||
|
this.apiEnabled.set(result)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
Template.boardMenuPopup.helpers({
|
Template.boardMenuPopup.helpers({
|
||||||
|
withApi() {
|
||||||
|
return Template.instance().apiEnabled.get()
|
||||||
|
},
|
||||||
exportUrl() {
|
exportUrl() {
|
||||||
const params = {
|
const params = {
|
||||||
boardId: Session.get('currentBoard'),
|
boardId: Session.get('currentBoard'),
|
||||||
|
|
@ -237,7 +248,7 @@ Template.memberPopup.events({
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
'click .js-change-role': Popup.open('changePermissions'),
|
'click .js-change-role': Popup.open('changePermissions'),
|
||||||
'click .js-remove-member': Popup.afterConfirm('removeMember', function() {
|
'click .js-remove-member': Popup.afterConfirm('removeMember', function () {
|
||||||
const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
const memberId = this.userId;
|
const memberId = this.userId;
|
||||||
Cards.find({ boardId, members: memberId }).forEach(card => {
|
Cards.find({ boardId, members: memberId }).forEach(card => {
|
||||||
|
|
@ -578,7 +589,7 @@ BlazeComponent.extendComponent({
|
||||||
'subtext-with-parent',
|
'subtext-with-parent',
|
||||||
'no-parent',
|
'no-parent',
|
||||||
];
|
];
|
||||||
options.forEach(function(element) {
|
options.forEach(function (element) {
|
||||||
if (element !== value) {
|
if (element !== value) {
|
||||||
$(`#${element} ${MCB}`).toggleClass(CKCLS, false);
|
$(`#${element} ${MCB}`).toggleClass(CKCLS, false);
|
||||||
$(`#${element}`).toggleClass(CKCLS, false);
|
$(`#${element}`).toggleClass(CKCLS, false);
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,10 @@ if (Meteor.isServer) {
|
||||||
return process.env.CAS_ENABLED === 'true';
|
return process.env.CAS_ENABLED === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isApiEnabled() {
|
||||||
|
return process.env.WITH_API === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
sendInvitation(emails, boards) {
|
sendInvitation(emails, boards) {
|
||||||
check(emails, [String]);
|
check(emails, [String]);
|
||||||
|
|
@ -314,6 +318,10 @@ if (Meteor.isServer) {
|
||||||
return isCasEnabled();
|
return isCasEnabled();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_isApiEnabled() {
|
||||||
|
return isApiEnabled();
|
||||||
|
},
|
||||||
|
|
||||||
// Gets all connection methods to use it in the Template
|
// Gets all connection methods to use it in the Template
|
||||||
getAuthenticationsEnabled() {
|
getAuthenticationsEnabled() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue