Skip to content
Snippets Groups Projects
Commit dbf918f3 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier
Browse files

Merge branch 'circle-edit-redirect' into 'staging'

Circle edit redirect

See merge request startinblox/applications/sib-app!80
parents 19bd61ae d03e5893
No related branches found
No related tags found
1 merge request!80Circle edit redirect
......@@ -58,6 +58,7 @@ div.content-box__info
partial=''
submit-button='Save'
next='circle-information'
)
h2 Members list
......
......@@ -75,6 +75,23 @@ document.addEventListener('DOMContentLoaded', function (event) {
})
});
//- Watch every sib-forms & update data-src of linked sib-display
document.querySelectorAll('sib-form').forEach(function(el) {
el.addEventListener("save", function(event) {
//clear cache on this resource
//NOTE: this is required because the cache is not refreshed after POSTing changes on the resource
if(el.component.resource != null) el.component.resource.clearCache();
// if of the edited resource || id of the container of the created resource
const resourceId = event.detail.resource['@id'] || el.dataset.src;
//update all displays which use this resource
Array.from(document.querySelectorAll('sib-display'))
.filter(sibDisplay => sibDisplay.component.resourceId == resourceId) // keep only elements with resource == edited resource
.forEach(e => e.dataset.src = e.dataset.src); // and update them
});
});
document.querySelector('sib-auth').getUser().then(user => {
if (user !== null) {
// Hide login button if already logged
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment