perf: improve circle admin
This commit is contained in:
parent
31bd34df98
commit
e1bce61124
@ -36,12 +36,10 @@ function recursiveAdaptWidgets(prefix, element, user) {
|
||||
}
|
||||
|
||||
//- In case your sib-display use a multiple, you have to target sub-sib-display auto-generated
|
||||
if (element.getAttribute(prefix + "-widgets-multiple") !== null) {
|
||||
element.querySelectorAll("div > sib-display").forEach(el => {
|
||||
element.querySelectorAll("sib-display, sib-form, div > sib-display, div > sib-form").forEach(el => {
|
||||
el.setAttribute(prefix + "-widgets", "");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//- This function is hooked every time a sib-something with prefix+"-widgets" is populated
|
||||
element.querySelectorAll("[" + prefix + "-widgets]").forEach(elementChild => {
|
||||
@ -125,6 +123,7 @@ async function refreshResource(event) {
|
||||
if(resourceId.includes('circle') && user != null) {
|
||||
let userId = user['@id'];
|
||||
refreshSibDisplays(userId + "circles/");
|
||||
refreshSibDisplays(resourceId.split('/').slice(0,4).join('/')+'/joinable/');
|
||||
}
|
||||
|
||||
//clear cache on this resource
|
||||
|
@ -51,57 +51,50 @@
|
||||
data-label='Leave circle'
|
||||
)
|
||||
|
||||
sib-display(
|
||||
class='table-body'
|
||||
|
||||
bind-user
|
||||
nested-field='circles'
|
||||
fields='circle.name, circle.owner, leaveButton'
|
||||
|
||||
class-circle.name='w33 cell border cell-with-name'
|
||||
class-circle.owner='w33 cell border cell-with-id-card'
|
||||
class-leaveButton='w33 cell border cell-with-buttons'
|
||||
|
||||
action-leaveButton="joinButton"
|
||||
widget-leaveButton="admin-circle-leave-button"
|
||||
widget-circle.owner='circle-owner'
|
||||
)
|
||||
|
||||
sib-widget(name='admin-circle-join-button')
|
||||
template
|
||||
button.button.text-bold.text-uppercase.reversed.button-blue.bordered.with-icon.icon-arrow-right-circle.test
|
||||
sib-form(
|
||||
data-src=''
|
||||
nested-field='members'
|
||||
sib-form.button.text-bold.text-uppercase.reversed.button-blue.bordered.with-icon.icon-arrow-right-circle.test(
|
||||
data-src='${value}'
|
||||
|
||||
fields='user.@id'
|
||||
label-user.@id=''
|
||||
value-user.@id=''
|
||||
value-user.@id='self'
|
||||
widget-user.@id='sib-form-hidden'
|
||||
|
||||
hd-inherit-bind-user2input="input[name='user.@id']"
|
||||
hd-inherit-widgets
|
||||
|
||||
submit-button='Join Circle'
|
||||
)
|
||||
|
||||
sib-widget(name="admin-circle-buttons")
|
||||
template
|
||||
sib-display(
|
||||
data-src='${src}'
|
||||
nested-field='members'
|
||||
fields='relation'
|
||||
action-relation='relation'
|
||||
widget-relation='admin-circle-leave-button'
|
||||
search-fields='user'
|
||||
search-widget-user='sib-form-hidden'
|
||||
search-value-user="-"
|
||||
empty-widget='admin-circle-join-button'
|
||||
hd-inherit-bind-resources='admin-circle-join-button'
|
||||
hd-inherit-user-id="search-value-user"
|
||||
hd-inherit-widgets
|
||||
)
|
||||
|
||||
sib-display(
|
||||
class='table-body'
|
||||
|
||||
data-src=`${endpoints.circles || endpoints.get.circles}`
|
||||
fields='name, owner, buttons'
|
||||
data-src=`${endpoints.circles || endpoints.get.circles}joinable/`
|
||||
fields='name, owner, members'
|
||||
|
||||
class-name='w33 cell border cell-with-name'
|
||||
class-owner='w33 cell border cell-with-id-card'
|
||||
class-buttons='w33 cell border cell-with-buttons'
|
||||
|
||||
widget-buttons="admin-circle-buttons"
|
||||
action-buttons="buttons"
|
||||
hd-inherit-widgets
|
||||
hd-inherit-widgets-multiple
|
||||
|
||||
widget-owner='circle-owner'
|
||||
|
||||
class-members='w33 cell border cell-with-buttons'
|
||||
widget-members="admin-circle-join-button"
|
||||
hd-inherit-bind-user2input="input[name='user.@id']"
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user