diff options
| author | 2022-10-25 18:18:43 -0400 | |
|---|---|---|
| committer | 2022-10-26 00:18:43 +0200 | |
| commit | 9e27ab9200bb78898f7085cbea1a6525aafe13cb (patch) | |
| tree | b84a68541ef448a682d1d067cac85ec3293572a4 /p/scripts | |
| parent | c5539009c910e5e5b2f2fca20c86c240a1d470da (diff) | |
Fix integration page (#4774)
Before, when adding a simple integration, the delete button was missing until
the configuration was saved. This behavior was introduced in #4269, but I think
that it was a regression.
Now, the delete button is back and everything is working as it should.
In the process, I've extracted templates in attributes and add them in template
tags. This way, it is easier to validate that the HTML code is valid.
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/integration.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/p/scripts/integration.js b/p/scripts/integration.js index d837ac9a0..17760a04f 100644 --- a/p/scripts/integration.js +++ b/p/scripts/integration.js @@ -14,7 +14,9 @@ const init_integration = function () { document.querySelector('.share.add').addEventListener('click', event => { const shareTypes = event.target.closest('.group-controls').querySelector('select'); const shareType = shareTypes.options[shareTypes.selectedIndex]; - let newShare = event.target.closest('form').getAttribute('data-' + shareType.getAttribute('data-form')); + const template = document.getElementById(shareType.getAttribute('data-form') + '-share'); + let newShare = template.content.cloneNode(true).querySelector('formgroup').outerHTML; + newShare = newShare.replace(/##label##/g, shareType.text); newShare = newShare.replace(/##type##/g, shareType.value); newShare = newShare.replace(/##help##/g, shareType.getAttribute('data-help')); |
