feature: user administration

This commit is contained in:
Jean-Baptiste Pasquier 2020-04-08 10:57:05 +00:00
parent 775bf6b222
commit 23116d81ca
15 changed files with 213 additions and 30 deletions

View File

@ -15,6 +15,7 @@
"events": "http://localhost:8000/events/", "events": "http://localhost:8000/events/",
"typeevents": "http://localhost:8000/typeevents/", "typeevents": "http://localhost:8000/typeevents/",
"users": "http://localhost:8000/users/", "users": "http://localhost:8000/users/",
"groups": "http://localhost:8000/groups/",
"uploads": "http://localhost:8000/upload/" "uploads": "http://localhost:8000/upload/"
}, },
"post": { "post": {
@ -24,6 +25,7 @@
"events": "http://localhost:8000/events/", "events": "http://localhost:8000/events/",
"typeevents": "http://localhost:8000/typeevents/", "typeevents": "http://localhost:8000/typeevents/",
"users": "http://localhost:8000/users/", "users": "http://localhost:8000/users/",
"groups": "http://localhost:8000/groups/",
"uploads": "http://localhost:8000/upload/" "uploads": "http://localhost:8000/upload/"
} }
}, },

View File

@ -12,6 +12,7 @@
"projects": "http://localhost:8000/projects/", "projects": "http://localhost:8000/projects/",
"customers": "http://localhost:8000/customers/", "customers": "http://localhost:8000/customers/",
"events": "http://localhost:8000/events/", "events": "http://localhost:8000/events/",
"groups": "http://localhost:8000/groups/",
"typeevents": "http://localhost:8000/typeevents/", "typeevents": "http://localhost:8000/typeevents/",
"users": "http://localhost:8000/users/", "users": "http://localhost:8000/users/",
"uploads": "http://localhost:8000/upload/" "uploads": "http://localhost:8000/upload/"

View File

@ -5,7 +5,7 @@
if endpoints.projects || (endpoints.get && endpoints.get.projects) if endpoints.projects || (endpoints.get && endpoints.get.projects)
#admin-projects(hidden) #admin-projects(hidden)
include views/admin/page-admin-projects.pug include views/admin/page-admin-projects.pug
if publicDirectory && (endpoints.users || (endpoints.get && endpoints.get.users)) if (endpoints.users || (endpoints.get && endpoints.get.users))
#admin-users(hidden) #admin-users(hidden)
include views/admin/page-admin-users.pug include views/admin/page-admin-users.pug
nav.jsRightMenu(role='navigation') nav.jsRightMenu(role='navigation')
@ -13,7 +13,7 @@ nav.jsRightMenu(role='navigation')
ul ul
li.jsOffsiteToggle li.jsOffsiteToggle
a Fold menu a Fold menu
if publicDirectory && (endpoints.users || (endpoints.get && endpoints.get.users)) if (endpoints.users || (endpoints.get && endpoints.get.users))
sib-route(name='admin-users') sib-route(name='admin-users')
li li
a Users a Users

View File

@ -1,5 +1,7 @@
#admin-circle-create, #admin-circle-create,
#admin-project-create { #admin-project-create,
#admin-users-create,
#admin-users-edit {
input[type='submit'] { input[type='submit'] {
@extend .button, @extend .button,
@ -42,12 +44,17 @@
margin-bottom: 2.75rem; margin-bottom: 2.75rem;
} }
[name$='border-top'] {
border-top: 1px solid $color-221-51-90;
margin-top: 3rem;
}
form { form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
sib-set-default { sib-set-default:not([name='user-thumb']) {
clear: both; clear: both;
display: flex!important; display: flex!important;
flex-wrap: wrap; flex-wrap: wrap;
@ -314,6 +321,14 @@
sib-multiple-select { sib-multiple-select {
&.select-groups .ss-values .ss-disabled::before {
content: "Select groups";
}
&.select-skills .ss-values .ss-disabled::before {
content: "Select skills";
}
sib-form-auto-completion > label { sib-form-auto-completion > label {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -363,7 +378,6 @@
&::before { &::before {
color: $color-213-4-50; color: $color-213-4-50;
content: "Select skills";
font-weight: normal; font-weight: normal;
} }
} }

View File

@ -82,7 +82,8 @@ nav {
/* Quick fix. Will be removed later */ /* Quick fix. Will be removed later */
#admin-circles, #admin-circles,
#admin-projects { #admin-projects,
#admin-users {
display: contents; display: contents;
} }
@ -384,7 +385,8 @@ a,
&.rounded { &.rounded {
border-radius: 50%; border-radius: 50%;
padding: 0.5rem 1rem; font-size: 1.8rem;
padding: 1rem;
} }
&.button-link { &.button-link {

View File

@ -4,7 +4,8 @@
#admin-circle-create, #admin-circle-create,
#project-edit, #project-edit,
#admin-project-list, #admin-project-list,
#admin-project-create { #admin-project-create,
#admin-users-list {
.table { .table {
@ -68,13 +69,39 @@
} }
} }
.cell-with-buttons {
align-items: center;
display: flex;
justify-content: center;
[name='button'] {
input[type='submit'] {
@extend .button,
.text-bold,
.text-uppercase,
.reversed,
.button-blue,
.bordered,
.btn-margin-left;
}
}
}
.cell-with-groups {
align-items: center;
display: flex;
justify-content: center;
}
.cell-with-name { .cell-with-name {
color: $color-233-18-29; color: $color-233-18-29;
font-weight: 600; font-weight: 600;
padding-top: 2.5rem; padding-top: 2.5rem;
} }
.user-thumb>div /* for the table in circle-edit and captain's cell in project-admin */ { .user-thumb>div /* for the table in circle-edit and captain's cell in project-admin */,
[name='user-thumb'] {
@extend %user-thumb__grid; @extend %user-thumb__grid;
padding: 0 2.2rem; padding: 0 2.2rem;
@ -107,22 +134,15 @@
} }
} }
.cell-with-buttons { .cell-with-groups {
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
[name='button'] { >div {
display: flex;
input[type='submit'] { justify-content: space-evenly;
@extend .button, width: 100%;
.text-bold,
.text-uppercase,
.reversed,
.button-blue,
.bordered,
.btn-margin-left;
}
} }
} }

View File

@ -82,6 +82,13 @@
} }
} }
&[name*='users'] {
>li::before {
font-size: 5rem;
}
}
&[name$='chat']>li { &[name$='chat']>li {
@include ci('chat'); @include ci('chat');
} }
@ -102,6 +109,10 @@
@include ci('file'); @include ci('file');
} }
&[name='admin-users']>li {
@include ci('drawing');
}
&[name='admin-circles']>li { &[name='admin-circles']>li {
@include ci('bubble-add'); @include ci('bubble-add');
} }

View File

@ -1 +1,2 @@
@import 'user-profile'; @import 'user-profile';
@import 'admin-users';

View File

@ -0,0 +1,6 @@
/* Fix. Could disappear when we can add .class on set fields */
sib-set-default[name='cell-1'] {
@extend .w33;
@extend .cell;
@extend .border;
}

View File

@ -8,6 +8,9 @@ div.content-box__info
fields='name, description' fields='name, description'
label-name='Name *'
label-description='Description *'
class-name='form-label is-light is-full-width' class-name='form-label is-light is-full-width'
class-description='form-label is-light is-full-width' class-description='form-label is-light is-full-width'

View File

@ -0,0 +1,35 @@
div.content-box__info
sib-link(class='backlink right', next='admin-users-list') Back
h1.centered Add a new user to the platform
sib-form(
data-src=`${endpoints.users || endpoints.post.users}`
range-groups=`${endpoints.groups || endpoints.get.groups}`
fields='line-1(first_name, last_name), line-2(username, email), line-3(password), line-4-border-top(groups)'
class-first_name='form-label is-light is-half-width'
class-last_name='form-label is-light is-half-width'
class-username='form-label is-light is-half-width'
class-email='form-label is-light is-half-width'
class-groups='form-label is-light is-half-width select-groups'
label-first_name='First Name *'
label-last_name='Last Name *'
label-username='Username *'
label-email='Email *'
label-groups='Groups'
multiple-groups='sib-multiple-select'
widget-groups='sib-form-auto-completion'
value-password=''
widget-password='sib-form-hidden'
next='admin-user-list'
submit-button='Create'
)
p Administrators of your platform can create new Groups on the Django Administration.

View File

@ -0,0 +1,35 @@
div.content-box__info
sib-link(class='backlink right', next='admin-users-list') Back
h1.centered
span Edit user
sib-display(
bind-resources=''
fields='name'
)
sib-form(
bind-resources=''
range-groups=`${endpoints.groups || endpoints.get.groups}`
fields='line-1(first_name, last_name), line-2(username, email), line-4-border-top(groups)'
class-first_name='form-label is-light is-half-width'
class-last_name='form-label is-light is-half-width'
class-username='form-label is-light is-half-width'
class-email='form-label is-light is-half-width'
class-groups='form-label is-light is-half-width select-groups'
label-first_name='First Name *'
label-last_name='Last Name *'
label-username='Username *'
label-email='Email *'
label-groups='Groups'
multiple-groups='sib-multiple-select'
widget-groups='sib-form-auto-completion'
next='admin-user-list'
submit-button='Save user'
)

View File

@ -2,17 +2,70 @@
sib-router(default-route='admin-users-list', hidden) sib-router(default-route='admin-users-list', hidden)
sib-route(name='admin-users-list') sib-route(name='admin-users-list')
sib-route(name='admin-users-create') sib-route(name='admin-users-create')
sib-route(name='admin-users-edit')
div.content-box__header div.content-box__header
h2 Administration h1.without-margin Administration
sib-widget(name='sib-action-hd-custom')
template
sib-ac-checker(data-src="${src}", permission='acl:Write')
sib-link(
class='button rounded reversed button-blue bordered icon-pencil'
data-src="${src}"
next="${value}"
)
sib-widget(name='hd-user-admin-groups-display')
template
sib-display(
data-src="${value}"
fields="name"
)
#admin-users-list(hidden) #admin-users-list(hidden)
div.content-box__info div.content-box__info
div.admin-header
div.admin-header__title Users
sib-ac-checker(data-src=`${endpoints.users || endpoints.post.users}`, permission='acl:Append')
sib-link(
class='button text-bold text-uppercase reversed button-yellow bordered with-icon icon-plus'
next='admin-users-create'
) Create a new user
.table
div.table-header.grey-color
div Name
div Groups
div
sib-display( sib-display(
class='table-body'
data-src=`${endpoints.users || endpoints.get.users}` data-src=`${endpoints.users || endpoints.get.users}`
fields="account.picture, name, username, email, groups" fields='cell-1(user-thumb(account.picture, sup(name), sub(username))), groups, actions'
multiple-groups=""
class-account.picture='user-thumb__picture'
class-name='user-thumb__name'
class-username='user-thumb__username'
class-profile.city='user-thumb__city'
widget-account.picture='hd-user-avatar'
class-groups='w33 cell border cell-with-groups'
multiple-groups=''
widget-groups='hd-user-admin-groups-display'
label-actions='Edit'
action-actions='admin-users-edit'
class-actions='w33 cell border cell-with-buttons'
widget-actions='sib-action-hd-custom'
order-by='username'
) )
#admin-users-create(hidden) #admin-users-create(hidden)
include page-admin-users-create.pug
#admin-users-edit(hidden)
include page-admin-users-edit.pug

View File

@ -14,7 +14,7 @@
label-description='Description*' label-description='Description*'
widget-description='sib-form-textarea' widget-description='sib-form-textarea'
class-skills='form-label is-dark' class-skills='form-label is-dark select-skills'
label-skills='The required skills for this mission:*' label-skills='The required skills for this mission:*'
multiple-skills='sib-multiple-select' multiple-skills='sib-multiple-select'
widget-skills='sib-form-auto-completion' widget-skills='sib-form-auto-completion'

View File

@ -14,7 +14,7 @@
label-description='Description*' label-description='Description*'
widget-description='sib-form-textarea' widget-description='sib-form-textarea'
class-skills='form-label is-dark' class-skills='form-label is-dark select-skills'
label-skills='The required skills for this mission:*' label-skills='The required skills for this mission:*'
multiple-skills='sib-multiple-select' multiple-skills='sib-multiple-select'
widget-skills='sib-form-auto-completion' widget-skills='sib-form-auto-completion'