update: add administration & circle creation

This commit is contained in:
Jean-Baptiste Pasquier
2019-10-25 19:15:45 +02:00
parent 1c2789812e
commit 09f35bd3c0
11 changed files with 285 additions and 185 deletions

View File

@ -46,9 +46,9 @@ document.addEventListener('DOMContentLoaded', function (event) {
for(sibForm of document.querySelectorAll('[set-user-id-select]')) {
sibForm.addEventListener('populate', () => {
document.querySelector('sib-form[submit-button="Join Circle"]').style.display = 'none';
if(document.querySelectorAll('sib-ac-checker:not([hidden]) > sib-delete[data-label="Leave circle"]').length == 0) {
document.querySelector('sib-form[submit-button="Join Circle"]').style.display = 'inline-block';
document.querySelectorAll('sib-form[submit-button^="Join"]').forEach(el=>el.style.display = 'none');
if(document.querySelectorAll('sib-ac-checker:not([hidden]) > sib-delete[data-label="^Leave"]').length == 0) {
document.querySelectorAll('sib-form[submit-button^="Join"]').forEach(el=>el.style.display = 'inline-block');
}
// BUG: Populate event trigger before the view is fully loaded! - https://git.happy-dev.fr/startinblox/framework/sib-core/issues/521
for(select of sibForm.querySelectorAll('select[name="'+sibForm.getAttribute('set-user-id-select')+'"]')) {
@ -58,6 +58,9 @@ document.addEventListener('DOMContentLoaded', function (event) {
}
});
}
for(leaveBtn of document.querySelectorAll('admin-circle-leave > sib-ac-checker:not([hidden])')) {
leaveBtn.parentNode.parentNode.parentNode.nextElementSibling.style.display = "none"; // Hide Join button
}
}
}).catch(error => console.log(error));