update: Cleanup circle information

This commit is contained in:
Jean-Baptiste Pasquier 2019-10-25 15:35:14 +02:00
parent 8e7547d06b
commit d4279b0c7a
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
10 changed files with 250 additions and 158 deletions

View File

@ -3,7 +3,7 @@ div.content-box__info
include templates/hd-user-avatar.pug include templates/hd-user-avatar.pug
sib-widget(name='hd-user-groups') sib-widget(name='hd-user-groups')
template ${await value.name} template ${value.name}
sib-widget(name='team-template-edit') sib-widget(name='team-template-edit')
template template
@ -19,17 +19,17 @@ div.content-box__info
sib-ac-checker( sib-ac-checker(
permission="acl:Delete" permission="acl:Delete"
data-src="${await value['@id']}" data-src="${value['@id']}"
) )
sib-delete( sib-delete(
data-src="${await value['@id']}" data-src="${value['@id']}"
data-label='Leave the circle' data-label='Leave the circle'
) )
//- Only to show the table grid //- Only to show the table grid
sib-ac-checker( sib-ac-checker(
no-permission="acl:Delete" no-permission="acl:Delete"
data-src="${await value['@id']}" data-src="${value['@id']}"
) )
sib-link(class="backlink", bind-resources, next='circle-profile') Back sib-link(class="backlink", bind-resources, next='circle-profile') Back

View File

@ -7,6 +7,7 @@
include templates/hd-circle-team.pug include templates/hd-circle-team.pug
div.content-box__header.with-edit div.content-box__header.with-edit
sib-ac-checker(permission='acl:Read', bind-resources)
sib-display( sib-display(
bind-resources bind-resources
fields='name' fields='name'
@ -14,13 +15,15 @@
class-name='name' class-name='name'
) )
sib-link(class="editlink", next="circle-edit" bind-resources)
div.content-box__info div.content-box__info
sib-ac-checker(permission='acl:Read', bind-resources)
sib-ac-checker(permission='acl:Write', bind-resources)
sib-link(class="right-btn", next="circle-edit", bind-resources) Edit and add Members
sib-display.block( sib-display.block(
bind-resources bind-resources
fields='label-description, description, entitled(title, creationDate)' fields='creationDateSet(title, creationDate), label-description, description'
value-label-description='Description: ' value-label-description='Description: '
@ -29,16 +32,20 @@
value-title='Creation date:' value-title='Creation date:'
) )
sib-ac-checker(permission='acl:Write' bind-resources, nested-field='team')
h2(name="label-team") Members:
//- TODO: sib-ac-checker unworking - https://git.happy-dev.fr/startinblox/framework/sib-core/issues/517
//- sib-ac-checker(permission='acl:Write', bind-resources, nested-field='team')
sib-form.block.team-form( sib-form.block.team-form(
bind-resources bind-resources
fields='team' nested-field='members'
range-team=`${endpoints.users}` fields='user'
partial='' range-user=`${endpoints.users}`
class-team='team form-label is-dark' class-user='team form-label is-dark'
label-team='Members:' label-user=''
widget-team='sib-form-auto-completion' widget-user='sib-form-auto-completion'
submit-button='Add a member' submit-button='Add a member'
) )
@ -48,8 +55,48 @@
fields='team' fields='team'
multiple-team='' multiple-team=''
widget-team='team-template' widget-team='circle-team-template'
) )
sib-ac-checker(permission='acl:Delete', bind-resources)
sib-delete(
bind-resources
data-label='Delete Circle'
class='right-btn reversed-btn'
)
sib-widget(name='join-leave-circle-button')
template
sib-ac-checker(
permission="acl:Delete"
data-src="${value['@id']}"
)
sib-delete(
data-src="${value['@id']}"
data-label='Leave circle'
)
sib-display(
bind-resources
fields='members'
multiple-members=''
widget-members='join-leave-circle-button'
)
sib-form.block.team-form(
bind-resources
nested-field='members'
fields='user'
label-user=''
range-user=`${endpoints.users}`
widget-user='sib-form-dropdown'
set-user-id-select="user"
submit-button='Join Circle'
)
#circle-edit(hidden) #circle-edit(hidden)
include page-circle-edit.pug include page-circle-edit.pug

View File

@ -25,7 +25,7 @@
widget-captain='captain-template', widget-captain='captain-template',
value-label-team='TEAM:', value-label-team='TEAM:',
widget-members='team-template', widget-members='project-team-template',
multiple-members, multiple-members,
bind-resources bind-resources

View File

@ -43,7 +43,24 @@ document.addEventListener('DOMContentLoaded', function (event) {
for(sibDisplay of document.querySelectorAll('sib-display[set-user-id]')) { for(sibDisplay of document.querySelectorAll('sib-display[set-user-id]')) {
sibDisplay.setAttribute(sibDisplay.getAttribute('set-user-id'), user['@id']); sibDisplay.setAttribute(sibDisplay.getAttribute('set-user-id'), user['@id']);
} }
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';
}
// 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')+'"]')) {
for(option of select.options) {
option.selected = (option.getAttribute('value') == '{"@id": "'+user['@id']+'"}');
}
}
});
}
} }
}).catch(error => console.log(error)); }).catch(error => console.log(error));
}); });

View File

@ -86,7 +86,7 @@
} }
} }
input[type='submit'] { input[type='submit'], .right-btn, sib-delete.right-btn button {
background-color: $color-233-18-29; background-color: $color-233-18-29;
border: none; border: none;
border-radius: 100em; border-radius: 100em;
@ -100,6 +100,31 @@
text-transform: uppercase; text-transform: uppercase;
} }
.reversed-btn, sib-delete.reversed-btn button {
background-color: transparent;
border: 1px solid #6157e5;
color: #6157e5;
}
sib-delete.right-btn {
border: none;
border-radius: 0;
margin: 0;
padding: 0;
}
sib-form[set-user-id-select] {
input[type="submit"] {
margin-left: 0;
margin-top: 0;
}
select {
display: none;
}
}
/* CLASSES Peut-être à sortir de .content-box */ /* CLASSES Peut-être à sortir de .content-box */
.block.team-form>form { /* circle-profile */ .block.team-form>form { /* circle-profile */

View File

@ -1,8 +1,4 @@
h2 { #circle-edit {
font-size: 1.7rem;
font-weight: bold;
text-transform: uppercase;
}
.table-header { .table-header {
background: $color-228-25-79; background: $color-228-25-79;
@ -138,3 +134,4 @@ sib-multiple[widget='team-template-edit'] {
} }
} }
} }
}

View File

@ -1,5 +1,11 @@
#circle-information, #circle-edit { #circle-information, #circle-edit {
h2 {
font-size: 1.7rem;
font-weight: bold;
text-transform: uppercase;
}
.content-box__info { .content-box__info {
@extend %padding-block; @extend %padding-block;
@ -58,7 +64,7 @@
display: none; display: none;
} }
>div>team-template[name='team']>sib-display>div { >div>circle-team-template[name='team']>sib-display>div {
display: grid; display: grid;
grid-column-gap: 1.6rem; grid-column-gap: 1.6rem;
grid-template-columns: 7vh auto; grid-template-columns: 7vh auto;

View File

@ -193,7 +193,7 @@
} }
} }
team-template[name='members'], captain-template[name='captain'] { project-team-template[name='members'], captain-template[name='captain'] {
display: grid; display: grid;
grid-column-gap: 1.6rem; grid-column-gap: 1.6rem;
grid-template-columns: 7vh auto; grid-template-columns: 7vh auto;

View File

@ -1,6 +1,6 @@
include hd-user-avatar.pug include hd-user-avatar.pug
sib-widget(name='team-template') sib-widget(name='circle-team-template')
template template
sib-display( sib-display(
data-src="${await value}" data-src="${await value}"

View File

@ -1,6 +1,6 @@
include hd-user-avatar.pug include hd-user-avatar.pug
sib-widget(name='team-template') sib-widget(name='project-team-template')
template template
sib-display.project-profile-user-avatar( sib-display.project-profile-user-avatar(
data-src="${value.user ? value.user['@id'] : ''}" data-src="${value.user ? value.user['@id'] : ''}"