Merge branch 'feature/user-admin' into 'release/profile-directory'

User administration, list create and edit

See merge request applications/sib-app!122
This commit is contained in:
Jean-Baptiste Pasquier 2020-04-08 10:57:05 +00:00
commit 418812574d
15 changed files with 213 additions and 30 deletions

View File

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

View File

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

View File

@ -5,7 +5,7 @@
if endpoints.projects || (endpoints.get && endpoints.get.projects)
#admin-projects(hidden)
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)
include views/admin/page-admin-users.pug
nav.jsRightMenu(role='navigation')
@ -13,7 +13,7 @@ nav.jsRightMenu(role='navigation')
ul
li.jsOffsiteToggle
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')
li
a Users

View File

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

View File

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

View File

@ -4,7 +4,8 @@
#admin-circle-create,
#project-edit,
#admin-project-list,
#admin-project-create {
#admin-project-create,
#admin-users-list {
.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 {
color: $color-233-18-29;
font-weight: 600;
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;
padding: 0 2.2rem;
@ -107,22 +134,15 @@
}
}
.cell-with-buttons {
.cell-with-groups {
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;
}
>div {
display: flex;
justify-content: space-evenly;
width: 100%;
}
}

View File

@ -82,6 +82,13 @@
}
}
&[name*='users'] {
>li::before {
font-size: 5rem;
}
}
&[name$='chat']>li {
@include ci('chat');
}
@ -102,6 +109,10 @@
@include ci('file');
}
&[name='admin-users']>li {
@include ci('drawing');
}
&[name='admin-circles']>li {
@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'
label-name='Name *'
label-description='Description *'
class-name='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-route(name='admin-users-list')
sib-route(name='admin-users-create')
sib-route(name='admin-users-edit')
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}"
)
#admin-users-list(hidden)
div.content-box__info
sib-widget(name='hd-user-admin-groups-display')
template
sib-display(
data-src=`${endpoints.users || endpoints.get.users}`
fields="account.picture, name, username, email, groups"
multiple-groups=""
data-src="${value}"
fields="name"
)
#admin-users-list(hidden)
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(
class='table-body'
data-src=`${endpoints.users || endpoints.get.users}`
fields='cell-1(user-thumb(account.picture, sup(name), sub(username))), groups, actions'
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)
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*'
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:*'
multiple-skills='sib-multiple-select'
widget-skills='sib-form-auto-completion'

View File

@ -14,7 +14,7 @@
label-description='Description*'
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:*'
multiple-skills='sib-multiple-select'
widget-skills='sib-form-auto-completion'