summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/components/boards/boardHeader.jade11
-rw-r--r--client/components/boards/boardHeader.js43
2 files changed, 54 insertions, 0 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade
index a5b7face..d33ee11b 100644
--- a/client/components/boards/boardHeader.jade
+++ b/client/components/boards/boardHeader.jade
@@ -112,6 +112,7 @@ template(name="boardMenuPopup")
ul.pop-over-list
li: a(href="{{exportUrl}}", download="{{exportFilename}}") {{_ 'export-board'}}
li: a.js-archive-board {{_ 'archive-board'}}
+ li: a.js-outgoing-webhooks {{_ 'outgoing-webhooks'}}
template(name="boardVisibilityList")
ul.pop-over-list
@@ -213,3 +214,13 @@ template(name="boardChangeTitlePopup")
template(name="archiveBoardPopup")
p {{_ 'close-board-pop'}}
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
+
+template(name="outgoingWebhooksPopup")
+ form
+ label
+ | URL
+ if integration.enabled
+ input.js-outgoing-webhooks-url(type="text" value=integration.url autofocus)
+ else
+ input.js-outgoing-webhooks-url(type="text" autofocus)
+ input.primary.wide(type="submit" value="{{_ 'save'}}")
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index c8b44824..dafbfd30 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -13,6 +13,7 @@ Template.boardMenuPopup.events({
// confirm that the board was successfully archived.
FlowRouter.go('home');
}),
+ 'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'),
});
Template.boardMenuPopup.helpers({
@@ -234,3 +235,45 @@ BlazeComponent.extendComponent({
}];
},
}).register('boardChangeWatchPopup');
+
+BlazeComponent.extendComponent({
+ integration() {
+ const boardId = Session.get('currentBoard');
+ return Integrations.findOne({ boardId: `${boardId}` });
+ },
+
+ events() {
+ return [{
+ 'submit'(evt) {
+ evt.preventDefault();
+ const url = this.find('.js-outgoing-webhooks-url').value.trim();
+ const boardId = Session.get('currentBoard');
+ const integration = this.integration();
+ if (integration) {
+ if (url) {
+ Integrations.update(integration._id, {
+ $set: {
+ enabled: true,
+ url: `${url}`,
+ },
+ });
+ } else {
+ Integrations.update(integration._id, {
+ $set: {
+ enabled: false,
+ },
+ });
+ }
+ } else if (url) {
+ Integrations.insert({
+ enabled: true,
+ type: 'outgoing-webhooks',
+ url: `${url}`,
+ boardId: `${boardId}`,
+ });
+ }
+ Popup.close();
+ },
+ }];
+ },
+}).register('outgoingWebhooksPopup');