Merge branch 'master' into feature/resource-component

This commit is contained in:
Jean-Baptiste Pasquier 2020-10-19 10:49:44 +02:00
commit 353b010795
19 changed files with 284 additions and 238 deletions

View File

@ -100,6 +100,7 @@ test3:
script:
- echo "$APP_CONFIG_TEST3" > config.json
- echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
- sed -i -E 's/component-chat@([0-9]+).([0-9]+)/component-chat@beta/g' src/dependencies.pug
- npm run build
- scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test3@astral.startinblox.com:~/front/
only:

View File

@ -18,6 +18,7 @@ To install Hubl, you'll need:
Before diving in you have to check your Hubl Server supports the following LDP packages:
* djangoldp_account
* djangoldp_community
* djangoldp_notification
* djangoldp_profile
* djangoldp_skill
@ -91,6 +92,16 @@ Where:
* `authority` is the OpenID Provider. Usually, if you use `djangoldp-account` it's the same as your djangoldp server.
* `endpoints.users` is the API endpoints for Users on your djangoldp server.
### Communities
Communities are mandatory to have an Hubl. If you're upgrading an existion Hubl, you can assign all your local users to a community this way:
```bash
./manage.py create_community --name="My community"
```
Don't forget to set some users as admin from the Django Admin if you want to allow them to create new users from app.
### Optional personalisation
On `config.json`:

View File

@ -1,54 +1,56 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Create User Browser Testing', () => {
let firstName = 'First ',
lastName = 'Last ',
username = 'testuser_creation_',
email = '';
before(() => {
cy.randomNum().then(num => {
firstName += num;
lastName += num;
username += num;
email = username + '@testemail.com';
});
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screen', () => cy.userLogin());
it('should login', () => cy.login());
describe('User Creation process', () => {
it('should visit the user creation screen', () => {
cy.visit('/admin/admin-users/admin-users-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-users/admin-users-create');
});
});
it('should enter correct user data', () => {
cy.get('#admin-users-create input[name="first_name"]').clear().type(firstName);
cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);
cy.get('#admin-users-create input[name="last_name"]').clear().type(lastName);
cy.get('#admin-users-create input[name="last_name"]').should('have.value', lastName);
cy.get('#admin-users-create input[name="username"]').clear().type(username);
cy.get('#admin-users-create input[name="username"]').should('have.value', username);
cy.get('#admin-users-create input[name="email"]').clear().type(email);
cy.get('#admin-users-create input[name="email"]').should('have.value', email);
});
it('should click on create user button', () => {
cy.get('#admin-users-create input[type="submit"]').click();
});
it('should land on users list screen', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-users');
});
});
it('should land newly created user on users list screen', () => {
cy.contains('solid-display-value[name="name"]', firstName + ' ' + lastName).should("exist");
cy.contains('solid-display-value[name="username"]', username).should("exist");
});
});
});
// Unable to create an user without a community. Unable to create community from app
// context('Create User Browser Testing', () => {
// let firstName = 'First ',
// lastName = 'Last ',
// username = 'testuser_creation_',
// email = '';
// before(() => {
// cy.randomNum().then(num => {
// firstName += num;
// lastName += num;
// username += num;
// email = username + '@testemail.com';
// });
// cy.clearLocalStorageSnapshot();
// cy.clearLocalStorage({ domain: null });
// cy.clearCookies({ domain: null });
// });
// beforeEach(() => cy.restoreLocalStorage());
// afterEach(() => cy.saveLocalStorage());
// it('should visit user login screen', () => cy.userLogin());
// it('should login', () => cy.login());
// describe('User Creation process', () => {
// it('should visit the user creation screen', () => {
// cy.visit('/admin/admin-users/admin-users-create');
// cy.location().should((loc) => {
// expect(loc.pathname).to.eq('/admin/admin-users/admin-users-create');
// });
// });
// it('should enter correct user data', () => {
// cy.get('#admin-users-create input[name="first_name"]').clear().type(firstName);
// cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);
// cy.get('#admin-users-create input[name="last_name"]').clear().type(lastName);
// cy.get('#admin-users-create input[name="last_name"]').should('have.value', lastName);
// cy.get('#admin-users-create input[name="username"]').clear().type(username);
// cy.get('#admin-users-create input[name="username"]').should('have.value', username);
// cy.get('#admin-users-create input[name="email"]').clear().type(email);
// cy.get('#admin-users-create input[name="email"]').should('have.value', email);
// });
// it('should click on create user button', () => {
// cy.get('#admin-users-create input[type="submit"]').click();
// });
// it('should land on users list screen', () => {
// cy.location().should((loc) => {
// expect(loc.pathname).to.eq('/admin/admin-users');
// });
// });
// it('should land newly created user on users list screen', () => {
// cy.contains('solid-display-value[name="name"]', firstName + ' ' + lastName).should("exist");
// cy.contains('solid-display-value[name="username"]', username).should("exist");
// });
// });
// });

View File

@ -29,7 +29,7 @@ if endpoints.joboffers || (endpoints.get && endpoints.get.joboffers)
//- script(type="module" src="/lib/solid-job-board/dist/index.js" defer)
if (endpoints.uploads || (endpoints.get && endpoints.get.uploads)) && (endpoints.skills || (endpoints.get && endpoints.get.skills)) && (endpoints.users || (endpoints.get && endpoints.get.users))
script(type="module" src="https://unpkg.com/@startinblox/component-directory@0.9" defer)
script(type="module" src="https://unpkg.com/@startinblox/component-directory@0.10" defer)
//- script(type="module" src="/lib/solid-directory/dist/index.js" defer)
if endpoints.dashboards || (endpoints.get && endpoints.get.dashboards)

View File

@ -21,31 +21,33 @@ solid-widget(name='hubl-create')
solid-widget(name='hubl-menu-fix-url-circle')
template
solid-display(
data-src='${value}'
fields='status, name, jabberID, badge'
value-badge='${value}'
widget-status='hubl-menu-publicprivate'
widget-badge='hubl-counter'
widget-jabberID='hubl-menu-jabberid'
widget-name='solid-display-div'
order-by="name"
)
solid-link(data-src="${value}" next="circle")
solid-display(
data-src='${value}'
fields='status, name, jabberID, badge'
value-badge='${value}'
widget-status='hubl-menu-publicprivate'
widget-badge='hubl-counter'
widget-jabberID='hubl-menu-jabberid'
widget-name='solid-display-div'
order-by="name"
)
solid-widget(name='hubl-menu-fix-url-project')
template
solid-display(
data-src='${value}'
fields='status, project(customer.name, name, jabberID), badge'
class-name='project-name'
class-customer.name='project-customer'
value-badge='${value}'
widget-status='hubl-menu-publicprivate'
widget-jabberID='hubl-menu-jabberid'
widget-badge='hubl-counter'
widget-name='solid-display-div'
order-by="customer.name"
)
solid-link(data-src="${value}" next="project")
solid-display(
data-src='${value}'
fields='status, project(customer.name, name, jabberID), badge'
class-name='project-name'
class-customer.name='project-customer'
value-badge='${value}'
widget-status='hubl-menu-publicprivate'
widget-jabberID='hubl-menu-jabberid'
widget-badge='hubl-counter'
widget-name='solid-display-div'
order-by="customer.name"
)
solid-router#navbar-router(default-route='dashboard')
@ -104,8 +106,6 @@ solid-router#navbar-router(default-route='dashboard')
empty-widget='hubl-create'
empty-value='projet'
widget-project='hubl-menu-fix-url-project'
order-by='project.customer.name'
next='project'
)
div.divider
if endpoints.circles || (endpoints.get && endpoints.get.circles)
@ -133,8 +133,6 @@ solid-router#navbar-router(default-route='dashboard')
empty-widget='hubl-create'
empty-value='cercle'
widget-circle='hubl-menu-fix-url-circle'
order-by='circle.name'
next='circle'
)
div.divider
if endpoints.users || (endpoints.get && endpoints.get.users)

View File

@ -6,17 +6,17 @@
#admin-projects(hidden)
include views/admin/page-admin-projects.pug
if (endpoints.users || (endpoints.get && endpoints.get.users))
#admin-users(hidden)
include views/admin/page-admin-users.pug
#admin-communities(hidden)
include views/admin/page-admin-communities.pug
nav.jsRightMenu(role='navigation')
solid-router(default-route='admin-circles')
ul
li.jsOffsiteToggle
a Replier le menu
if (endpoints.users || (endpoints.get && endpoints.get.users))
solid-route.active-color(name='admin-users')
solid-route(name='admin-communities')
li
a Utilisateurs
a Communautés
if endpoints.circles || (endpoints.get && endpoints.get.circles)
solid-route(name='admin-circles')
li

View File

@ -752,6 +752,29 @@ a,
}
}
&.button-disabled{
cursor: not-allowed;
background-color: var(--color-white);
*,
& {
color: var(--color-grey-3);
}
&.bordered {
border: 1px solid var(--color-grey-3);
}
&:hover {
background-color: var(--color-white);
*,
& {
color: var(--color-grey-3);
}
}
}
&.button-secondary {
background-color: var(--color-white);
@ -816,6 +839,29 @@ a,
}
}
&.button-disabled{
cursor: not-allowed;
background-color: var(--color-grey-3);
*,
& {
color: var(--color-white);
}
&.bordered {
border: 1px solid var(--color-white);
}
&:hover {
background-color: var(--color-grey-3);
*,
& {
color: var(--color-white);
}
}
}
&.button-secondary {
background-color: var(--color-secondary);

View File

@ -238,8 +238,8 @@
color: var(--color-white);
cursor: pointer;
>hubl-menu-fix-url-circle>solid-display>div,
>hubl-menu-fix-url-project>solid-display>div {
>hubl-menu-fix-url-circle>solid-link>solid-display>div,
>hubl-menu-fix-url-project>solid-link>solid-display>div {
padding: 1rem 1rem 1rem 3rem;
}
}
@ -250,8 +250,8 @@
}
&>solid-display[active]>div,
&>solid-display>div>hubl-menu-fix-url-circle>solid-display[active]>div,
&>solid-display>div>hubl-menu-fix-url-project>solid-display[active]>div {
&>solid-display>div>hubl-menu-fix-url-circle>solid-link>solid-display[active]>div,
&>solid-display>div>hubl-menu-fix-url-project>solid-link>solid-display[active]>div {
background-color: var(--color-menu-highlight-primary);
color: var(--color-menu-text-active);
font-weight: bold;
@ -266,8 +266,8 @@
}
>solid-display>div>solid-display>div,
>solid-display>div>solid-display>div>hubl-menu-fix-url-circle>solid-display>div,
>solid-display>div>solid-display>div>hubl-menu-fix-url-project>solid-display>div {
>solid-display>div>solid-display>div>hubl-menu-fix-url-circle>solid-link>solid-display>div,
>solid-display>div>solid-display>div>hubl-menu-fix-url-project>solid-link>solid-display>div {
display: flex;
justify-content: space-between;
}

View File

@ -118,6 +118,14 @@
width: 280px;
}
.w450 {
width: 450px;
}
.w370 {
width: 370px;
}
.w230 {
width: 230px;
}

View File

@ -66,8 +66,33 @@
content: '@';
}
}
solid-multiple[name="user.communities"] {
* {
display: contents;
}
solid-display-value {
&:after {
content: ",";
margin-right: 5px;
}
display: inline-block!important;
}
>solid-display>div>solid-display:last-child>div>solid-display-value:after {
display: none;
}
>solid-display {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: calc(50% - 22px - 0.5rem);
line-height: 22px;
}
.user-thumb__city:not(:empty) {
@include mdi('atom');
align-items: center;
display: flex;

View File

@ -86,7 +86,8 @@
>solid-route {
&[name*='circle'],
&[name*='project'] {
&[name*='project'],
&[name*='communities'] {
>li::before {
font-size: 4rem;
@ -120,16 +121,8 @@
@include ci('file');
}
&[name='admin-users']>li::before {
background-color: var(--color-secondary);
content: '';
display: inline-block;
height: 40px;
mask: url('/images/add-user.svg') 1% 1% / 1px 1px no-repeat;
mask-size: cover;
-webkit-mask: url('/images/add-user.svg') 1% 1% / 1px 1px no-repeat;
-webkit-mask-size: cover;
width: 40px;
&[name='admin-communities']>li {
@include ci('networking');
}
&[name='admin-circles']>li {

View File

@ -0,0 +1,53 @@
.content-box.flex.full-width.with-form
solid-router(default-route='admin-communities-list', hidden)
solid-route(name='admin-communities-list')
solid-route(name='admin-users-create', use-id)
div.content-box__header.flex.space-between
h1.without-margin Administration
button.mobile-sidebar-button.jsMobileSidebarOpenButton.icon-arrow-left-circle MENU
solid-widget(name='hubl-action-community')
template
solid-ac-checker(data-src="${value}", nested-field="members", permission='acl:Append')
solid-link(
class='button text-bold text-uppercase reversed button-primary bordered with-icon icon-plus'
data-src="${value}"
next="admin-users-create"
) Inviter un nouvel utilisateur
solid-ac-checker(data-src="${value}", nested-field="members", no-permission='acl:Append')
div.button.text-bold.text-uppercase.button-disabled Membre, aucune permission
#admin-communities-list.content-box__height(hidden)
div.content-box__info.flex
div.admin-header.flex
h3 Communautés
.table-wrapper
.table
div.table-header.grey-color
div.w450 Nom
div.w370 Action
solid-display(
class='table-body'
bind-user
nested-field='communities'
fields='community.name, community'
loader-id='loader-admin-community'
class-community.name='w450 border cell-with-name'
class-community='w370 border cell-with-buttons is-spaced'
widget-community='hubl-action-community'
order-asc='community.name'
)
div#loader-admin-community.loader.loader-top
div
div
div
div
#admin-users-create.content-box__height(hidden)
include page-admin-users-create.pug

View File

@ -1,7 +1,18 @@
div.content-box__info.flex
solid-link(class='backlink right', next='admin-users-list') Retour
solid-link(class='backlink right', next='admin-communities-list') Retour
h1.centered Ajouter un utilisateur à la plateforme
solid-display.h1-like.centered(
bind-resources
fields='text, name'
value-text="Inviter un utilisateur à "
loader-id='loader-users-title'
)
div#loader-users-title.loader.loader
div
div
div
div
div#loader-users-create.loader.loader-top
div
@ -19,33 +30,34 @@ div.content-box__info.flex
label E-mail *
input(type="email" label="E-mail *" name="email" required value="\${value}" data-holder)
solid-form.form.button-register(
data-src=`${endpoints.users || endpoints.post.users}`
solid-form.form.button-register#selected-community(
bind-resources
nested-field='members'
fields='line-1(first_name, last_name), line-2(username, email), line-3(password)'
required-first_name
required-last_name
required-username
required-email
fields='line-1(user.first_name, user.last_name), line-2(user.username, user.email), user.password'
required-user.first_name
required-user.last_name
required-user.username
required-user.email
loader-id='loader-users-create'
class-first_name='form-label is-light is-half-width input-text-like'
class-last_name='form-label is-light is-half-width input-text-like'
class-username='form-label is-light is-half-width input-text-like'
class-email='form-label is-light is-half-width input-text-like'
class-user.first_name='form-label is-light is-half-width input-text-like'
class-user.last_name='form-label is-light is-half-width input-text-like'
class-user.username='form-label is-light is-half-width input-text-like'
class-user.email='form-label is-light is-half-width input-text-like'
label-first_name='Prénom *'
label-last_name='Nom *'
label-username='Nom d\'utilisateur *'
label-email='E-mail *'
label-user.first_name='Prénom *'
label-user.last_name='Nom *'
label-user.username='Nom d\'utilisateur *'
label-user.email='E-mail *'
value-password=''
widget-password='solid-form-hidden'
value-user.password=''
widget-user.password='solid-form-hidden'
widget-username='hubl-username-field'
widget-email='hubl-email-field'
widget-user.username='hubl-username-field'
widget-user.email='hubl-email-field'
next='admin-users-list'
next='admin-communities-list'
submit-button='Enregistrer'
submit-button='Inviter'
)

View File

@ -1,40 +0,0 @@
div.content-box__info.flex
solid-link(class='backlink right', next='admin-users-list') Retour
h1.centered
span Modifier un utilisateur
div#loader-users-edit.loader.loader-top
div
div
div
div
solid-display(
bind-resources=''
fields='name'
loader-id='loader-users-edit'
)
solid-form.form.button-register(
bind-resources=''
fields='line-1(first_name, last_name), line-2(email)'
required-first_name
required-last_name
required-email
loader-id='loader-users-edit'
class-first_name='form-label is-light is-half-width input-text-like'
class-last_name='form-label is-light is-half-width input-text-like'
class-email='form-label is-light is-full-width input-text-like'
label-first_name='Prénom *'
label-last_name='Nom *'
label-email='E-mail *'
widget-email='hubl-email-field'
next='admin-user-list'
submit-button='Enregistrer'
)

View File

@ -1,67 +0,0 @@
.content-box.flex.full-width.with-form
solid-router(default-route='admin-users-list', hidden)
solid-route(name='admin-users-list')
solid-route(name='admin-users-create')
solid-route(name='admin-users-edit')
div.content-box__header.flex.space-between
h1.without-margin Administration
button.mobile-sidebar-button.jsMobileSidebarOpenButton.icon-arrow-left-circle MENU
solid-widget(name='hubl-solid-action-custom')
template
solid-ac-checker(data-src="${src}", permission='acl:Write')
solid-link(
class='button rounded reversed button-primary bordered icon-pencil'
data-src="${src}"
next="${value}"
)
#admin-users-list.content-box__height(hidden)
div.content-box__info.flex
div.admin-header.flex
h3 Utilisateurs
solid-ac-checker(data-src=`${endpoints.users || endpoints.post.users}`, permission='acl:Append')
solid-link(
class='button text-bold text-uppercase reversed button-primary bordered with-icon icon-plus'
next='admin-users-create'
) Ajouter un utilisateur
.table-wrapper
.table
div.table-header.grey-color
div.w280 Nom
div.w70
solid-display(
class='table-body'
data-src=`${endpoints.users || endpoints.get.users}`
fields='cell-1(user-thumb(account.picture, sup(name), sub(username))), actions'
loader-id='loader-admin-users'
class-account.picture='avatar user-thumb__picture'
class-name='user-thumb__name'
class-username='user-thumb__username'
class-profile.city='user-thumb__city'
widget-account.picture='hubl-user-avatar'
label-actions='Edit'
action-actions='admin-users-edit'
class-actions='w70 border cell-with-buttons'
widget-actions='hubl-solid-action-custom'
order-by='username'
)
div#loader-admin-users.loader.loader-top
div
div
div
div
#admin-users-create.content-box__height(hidden)
include page-admin-users-create.pug
#admin-users-edit.content-box__height(hidden)
include page-admin-users-edit.pug

View File

@ -77,14 +77,15 @@ div.content-box__info
class='table-body'
bind-resources
nested-field='members'
fields='classGroup(classGrid(user.account.picture, sup(user.name, user.groups), sub(user.profile.city))), self'
fields='classGroup(classGrid(user.account.picture, sup(user.name, user.groups), sub(user.communities))), self'
loader-id='loader-circle-edit'
class-classGroup='w280 cell border cell-with-id-card user-thumb is-spaced'
class-user.account.picture='user-thumb__picture avatar'
class-user.name='user-thumb__name'
class-user.groups='user-thumb__groups'
class-user.profile.city='user-thumb__city'
multiple-user.communities
multiple-user.communities-fields="community.name"
widget-user.account.picture='hubl-user-avatar'

View File

@ -91,7 +91,7 @@ solid-router(default-route='circle-profile', hidden)
bind-resources
nested-field='members'
loader-id='loader-circle-profile'
fields='classGroup(user.account.picture, sup(user.name, user, is_admin), sub(user.profile.city))'
fields='classGroup(user.account.picture, sup(user.name, user, is_admin), sub(user.communities))'
widget-user='hubl-circle-team-contact'
@ -100,7 +100,8 @@ solid-router(default-route='circle-profile', hidden)
class-user.name='user-thumb__name'
class-user='user-thumb__send'
class-is_admin='user-thumb__admin'
class-user.profile.city='user-thumb__city'
multiple-user.communities
multiple-user.communities-fields="community.name"
widget-classGroup='solid-set-div'
widget-user.account.picture='hubl-user-avatar'

View File

@ -69,14 +69,15 @@ div.content-box__info
class='table-body'
bind-resources
nested-field='members'
fields='classGroup(classGrid(user.account.picture, sup(user.name, user.groups), sub(user.profile.city))), self'
fields='classGroup(classGrid(user.account.picture, sup(user.name, user.groups), sub(user.communities))), self'
loader-id='loader-project-edit'
class-classGroup='w280 cell border cell-with-id-card user-thumb is-spaced'
class-user.account.picture='user-thumb__picture avatar'
class-user.name='user-thumb__name'
class-user.groups='user-thumb__groups'
class-user.profile.city='user-thumb__city'
multiple-user.communities
multiple-user.communities-fields="community.name"
widget-user.account.picture='hubl-user-avatar'

View File

@ -89,7 +89,7 @@ solid-router(default-route='project-profile', hidden)
solid-display.block(
bind-resources
nested-field='members'
fields='classGroup(user.account.picture, sup(user.name, user, is_admin), sub(user.profile.city, name))'
fields='classGroup(user.account.picture, sup(user.name, user, is_admin), sub(user.communities, name))'
widget-user='hubl-project-team-contact'
@ -98,7 +98,8 @@ solid-router(default-route='project-profile', hidden)
class-user.name='user-thumb__name'
class-user='user-thumb__send'
class-is_admin='user-thumb__admin'
class-user.profile.city='user-thumb__city'
multiple-user.communities
multiple-user.communities-fields="community.name"
class-name='user-thumb__lead'
widget-classGroup='solid-set-div'