update: add administration & circle creation

This commit is contained in:
Jean-Baptiste Pasquier 2019-10-25 19:15:45 +02:00 committed by Gaëlle Morin
parent 9db2e1b99b
commit cb22295aa6
10 changed files with 141 additions and 36 deletions

View File

@ -38,5 +38,8 @@ html(lang="en")
#messages(hidden).with-sidebar #messages(hidden).with-sidebar
include page-messages.pug include page-messages.pug
#admin(hidden).with-sidebar
include page-admin.pug
//- #my-profile(hidden).no-sidebar //- #my-profile(hidden).no-sidebar
//- include page-user-profile.pug //- include page-user-profile.pug

View File

@ -15,8 +15,8 @@ nav#main__menu
//- sib-route.menu(name='job-offers', rdf-type='hd:joboffer') //- sib-route.menu(name='job-offers', rdf-type='hd:joboffer')
//- div.menu-label Job offers //- div.menu-label Job offers
//- div.menu-icon.icon-briefcase //- div.menu-icon.icon-briefcase
//- sib-route(hidden, name='job-offer-create') //- sib-route(name='job-offer-create')
//- sib-route(hidden, name='job-offer-edit', use-id) //- sib-route(name='job-offer-edit', use-id)
//- div.divider //- div.divider
//- div.menu-wrapper //- div.menu-wrapper
//- div.menu //- div.menu
@ -24,7 +24,7 @@ nav#main__menu
//- div.menu-icon.icon-arrow-up //- div.menu-icon.icon-arrow-up
//- div.menu-label Projects //- div.menu-label Projects
//- div.menu-icon.icon-folder-alt //- div.menu-icon.icon-folder-alt
//- sib-route(hidden,name='project', id-prefix=`${endpoints.projects}`, rdf-type='hd:project', use-id='') //- sib-route(name='project', rdf-type='hd:project', use-id='')
//- div.sub-menu.menu-notification //- div.sub-menu.menu-notification
//- sib-display( //- sib-display(
//- data-src=`${endpoints.projects}` //- data-src=`${endpoints.projects}`
@ -46,7 +46,7 @@ nav#main__menu
div.menu-icon.icon-arrow-up div.menu-icon.icon-arrow-up
div.menu-label Circles div.menu-label Circles
div.menu-icon.icon-folder-alt div.menu-icon.icon-folder-alt
sib-route(hidden,name='circle', id-prefix=`${endpoints.circles}`, rdf-type='hd:circle', use-id='') sib-route(name='circle', rdf-type='hd:circle', use-id='')
div.sub-menu.menu-notification div.sub-menu.menu-notification
sib-display( sib-display(
data-src=`${endpoints.circles}` data-src=`${endpoints.circles}`
@ -70,7 +70,7 @@ nav#main__menu
div.menu-icon.icon-arrow-up div.menu-icon.icon-arrow-up
div.menu-label Chat div.menu-label Chat
div.menu-icon.icon-envelope-letter div.menu-icon.icon-envelope-letter
sib-route(hidden, name='messages', id-prefix=`${endpoints.users}`, rdf-type='foaf:user', use-id='') sib-route(name='messages', rdf-type='foaf:user', use-id='')
div.sub-menu.menu-notification div.sub-menu.menu-notification
sib-display( sib-display(
data-src=`${endpoints.users}` data-src=`${endpoints.users}`
@ -82,6 +82,7 @@ nav#main__menu
next='messages' next='messages'
) )
sib-route(name='admin')
//- div.divider //- div.divider
//- sib-route.menu(hidden, name='my-profile', rdf-type='foaf:user', use-id='') //- sib-route.menu(hidden, name='my-profile', rdf-type='foaf:user', use-id='')

View File

@ -0,0 +1,19 @@
div.content-box__info
sib-link(class="backlink", next='admin-circle-list') Back
h1 New circle
p.center Here you can create a new circle according to your interests, what you want to share, etc.
sib-form.block(
data-src=`${endpoints.circles}`
fields='name, description'
class-name='form-label is-light is-full-width'
class-description='form-label is-light is-full-width'
widget-description='sib-form-textarea'
submit-button='Save'
)

View File

@ -0,0 +1,56 @@
.content-box.full-width.with-form
sib-router(default-route='admin-circle-list')
sib-route(name='admin-circle-list')
sib-route(name='admin-circle-create')
div.content-box__header
h2 Administration
#admin-circle-list(hidden)
sib-widget(name="admin-circle-leave")
template
sib-ac-checker(
permission="acl:Delete"
data-src="${value['@id']}"
)
sib-delete(
data-src="${value['@id']}"
data-label='Leave'
)
sib-widget(name="admin-circle-join")
template
sib-form(
data-src="${src}"
nested-field='members'
fields='user'
label-user=''
range-user=`${endpoints.users}`
widget-user='sib-form-dropdown'
set-user-id-select="user"
submit-button='Join'
)
div.content-box__info
sib-link(class="right-btn", next="admin-circle-create") Create a new circle
h3 Circles
sib-display.block(
data-src=`${endpoints.circles}`
fields="name, owner.name, buttons(members, button)"
search-fields="name"
search-label-name="Search a Circle"
multiple-groups=""
widget-members="admin-circle-leave"
multiple-members=""
widget-button="admin-circle-join"
action-button="button"
)
#admin-circle-create(hidden)
include page-admin-circles-create.pug

View File

@ -0,0 +1,10 @@
.content-box.full-width.with-form
sib-router(default-route='admin-project-list')
sib-route(name='admin-project-list')
sib-route(name='admin-project-create')
#admin-project-list(hidden)
#admin-project-create(hidden)

18
src/page-admin-users.pug Normal file
View File

@ -0,0 +1,18 @@
.content-box.full-width.with-form
sib-router(default-route='admin-users-list')
sib-route(name='admin-users-list')
sib-route(name='admin-users-create')
div.content-box__header
h2 Administration
#admin-users-list(hidden)
div.content-box__info
sib-display.block(
data-src=`${endpoints.users}`
fields="account.picture, name, username, email, groups"
multiple-groups=""
)
#admin-users-create(hidden)

21
src/page-admin.pug Normal file
View File

@ -0,0 +1,21 @@
.views-container
#admin-circles(hidden)
include page-admin-circles.pug
//- #admin-users(hidden)
//- include page-admin-users.pug
//- #admin-projects(hidden)
//- include page-admin-projects.pug
nav.jsRightMenu(role='navigation')
sib-router(default-route='admin-circles')
ul
li.jsOffsiteToggle
a Fold menu
//- sib-route(name='admin-users')
li
a Users
sib-route(name='admin-circles')
li
a Circles
//- sib-route(name='admin-projects')
li
a Projects

View File

@ -1,26 +0,0 @@
.content-box.with-padding.with-form.full-width
h1 New group
p Here you can create a new group according to your interests, what you want to share, etc.
sib-form(
data-src=`${endpoints.circles}`,
range-owner=`${endpoints.users}`,
range-team=`${endpoints.users}`
fields='name, description, description-text, owner, owner-text, team, team-text, jabberRoom, foaf:jabberID',
label-name="Channel's name",
label-description='Description',
label-owner='Owner of this channel',
label-foaf:jabberID='Chatroom id',
label-team='Member(s) of this channel',
value-description-text='You can write a short description like "Here, we are like Pinky and the Brain, we talk about strategy to conquer the world".',
value-owner-text='The one who will admin this channel',
value-team-text='Add any members as you want.',
widget-description='sib-form-textarea',
widget-jabberRoom='sib-form-checkbox',
)
//- widget-team='sib-form-multiple-dropdown'

View File

@ -4,6 +4,6 @@ nav(role="user's functionalities menu")
//- sib-link(next='my-profile') My profile //- sib-link(next='my-profile') My profile
//-li //-li
sib-link(next='user-settings') Settings sib-link(next='user-settings') Settings
//-li li
sib-link(name='user-admin') Admin sib-link(next='admin') Admin
button(role='log out' onclick="document.querySelector('sib-auth').logout();") Log out button(role='log out' onclick="document.querySelector('sib-auth').logout();") Log out

View File

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