diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2017-08-30 00:52:55 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2017-08-30 00:58:34 -0300 |
commit | 5bc95511e56af7cb4809dd8b2e4e9aedf275d63b (patch) | |
tree | 3685d5052a343aae79d38ff149195e9355d19d4a /client/components/boards | |
parent | f566022aa4cdddf20dd040c8fdc42b83f2cc340e (diff) | |
download | wekan-5bc95511e56af7cb4809dd8b2e4e9aedf275d63b.tar.gz wekan-5bc95511e56af7cb4809dd8b2e4e9aedf275d63b.tar.bz2 wekan-5bc95511e56af7cb4809dd8b2e4e9aedf275d63b.zip |
Allow delete from client. List all integrations in web UI
Diffstat (limited to 'client/components/boards')
-rw-r--r-- | client/components/boards/boardHeader.jade | 20 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 27 | ||||
-rw-r--r-- | client/components/boards/boardHeader.styl | 3 |
3 files changed, 34 insertions, 16 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index 3d98322d..9539fc79 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -227,11 +227,21 @@ template(name="archiveBoardPopup") button.js-confirm.negate.full(type="submit") {{_ 'archive'}} template(name="outgoingWebhooksPopup") - form + each integrations + form.integration-form + if title + h4 {{title}} + else + h4 {{_ 'no-name'}} + label + | URL + input.js-outgoing-webhooks-url(type="text" name="url" value=url) + input(type="hidden" value=_id name="id") + input.primary.wide(type="submit" value="{{_ 'save'}}") + form.integration-form + h4 + | {{_ 'new-integration'}} 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.js-outgoing-webhooks-url(type="text" name="url" autofocus) input.primary.wide(type="submit" value="{{_ 'save'}}") diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 2ee21905..b7807ca9 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -241,39 +241,44 @@ BlazeComponent.extendComponent({ }).register('boardChangeWatchPopup'); BlazeComponent.extendComponent({ - integration() { + integrations() { const boardId = Session.get('currentBoard'); - return Integrations.findOne({ boardId: `${boardId}` }); + return Integrations.find({ boardId: `${boardId}` }).fetch(); + }, + + integration(id) { + const boardId = Session.get('currentBoard'); + return Integrations.findOne({ _id: id, boardId: `${boardId}` }); }, events() { return [{ 'submit'(evt) { evt.preventDefault(); - const url = this.find('.js-outgoing-webhooks-url').value.trim(); + const url = evt.target.url.value; const boardId = Session.get('currentBoard'); - const integration = this.integration(); - if (integration) { + let id = null; + let integration = null; + if (evt.target.id) { + id = evt.target.id.value; + integration = this.integration(id); if (url) { Integrations.update(integration._id, { $set: { - enabled: true, url: `${url}`, }, }); } else { - Integrations.update(integration._id, { - $set: { - enabled: false, - }, - }); + Integrations.remove(integration._id); } } else if (url) { Integrations.insert({ + userId: Meteor.userId(), enabled: true, type: 'outgoing-webhooks', url: `${url}`, boardId: `${boardId}`, + activities: ['all'], }); } Popup.close(); diff --git a/client/components/boards/boardHeader.styl b/client/components/boards/boardHeader.styl new file mode 100644 index 00000000..0abdb5bd --- /dev/null +++ b/client/components/boards/boardHeader.styl @@ -0,0 +1,3 @@ +.integration-form + padding: 5px + border-bottom: 1px solid #ccc |