Adapted Sib App for ETUC & more flexible way to handle optional components

This commit is contained in:
Jean-Baptiste Pasquier 2020-02-03 14:39:14 +01:00
parent d37796f86f
commit 7eff652d5d
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
21 changed files with 171 additions and 154 deletions

View File

@ -10,20 +10,18 @@ These instructions will get you a copy of the project up and running on your loc
To install SiB App, you'll need: To install SiB App, you'll need:
* A SIB server with the appropriate modules * A SIB server (djangoldp>=0.6.32) with the appropriate modules
* A Prosody Server (with [appropriate modules](https://git.happy-dev.fr/startinblox/prosody/custom-prosody-modules/) * A Prosody Server (with [appropriate modules](https://git.happy-dev.fr/startinblox/prosody/custom-prosody-modules/)
* A SMTP Server (optional) * A SMTP Server (optional)
* NodeJS on your machine * NodeJS on your machine
Before diving in you have to check your SIB server supports the following LDP packages: Before diving in you have to check your SIB server supports the following LDP packages:
* djangoldp_account: 0.2.14 * djangoldp_account: 0.2.24
* djangoldp_circle: 0.1.15 * djangoldp_circle: 0.1.22
* djangoldp_joboffer: 0.1.1 * djangoldp_notification: 0.1.7
* djangoldp_notification: 0.1.4
* djangoldp_profile: 0.1.4 * djangoldp_profile: 0.1.4
* djangoldp_project: 0.1.12 * djangoldp_project: 0.1.26
* djangoldp_skill: 0.1.1
* oidc_provider: 'git+https://github.com/jblemee/django-oidc-provider.git@develop' * oidc_provider: 'git+https://github.com/jblemee/django-oidc-provider.git@develop'
Those packages are given with the last stable version tested. Those packages are given with the last stable version tested.
@ -40,16 +38,17 @@ Get the code of the SIB app on your machine:
git clone ... git clone ...
``` ```
Then create a `config.json` with all the the capabilities the SIB App requires. Which are: Then create a `config.json` based on your needs. [The documentation](https://git.happy-dev.fr/startinblox/devops/doc/wikis/build_sib_application) explains the details of this file but for convienence a `config.sample.json` exists in the source.
* circles Current Sib App capabilities:
* groups
* joboffers
* projects
* skills
* users
[The documentation](https://git.happy-dev.fr/startinblox/devops/doc/wikis/build_sib_application) explains the details of this file but for convienence a `config.sample.json` exists in the source. | Component | Required server packages | Required endpoints |
| - | - | - |
| Base | `djangoldp_account`, `djangoldp_profile`, `djangoldp_notification`, `oidc_provider` | `users` |
| Circles | `djangoldp_circle` | `circles` |
| Projects | `djangoldp_project` | `projects`, `customers` |
Federated Sib App needs to use `config.sample.federated.json` example.
Then build your new SIB App: Then build your new SIB App:
@ -70,19 +69,3 @@ npm run watch
## Built With ## Built With
* [Sib-Core](https://git.happy-dev.fr/startinblox/framework/sib-core/) - An awesome new framework! * [Sib-Core](https://git.happy-dev.fr/startinblox/framework/sib-core/) - An awesome new framework!
<!---
## Contributing
We may add a `CONTRIBUTING.md`
## License
We may add a `LICENSE.md`
## Acknowledgments
* Maybe some thanks too
* Inspiration
* etc
--->

View File

@ -0,0 +1,23 @@
{
"xmpp": "https://jabber.happy-dev.fr/http-bind/",
"authority": "http://localhost:8000/",
"clientName": "Sib App",
"clientLogo": "/images/logo.png",
"clientLogoHeight": "32px",
"clientCSS": "/path/to/custom.css",
"authorityName": "djangoldp-server-name",
"endpoints": {
"get": {
"circles": "http://localhost:8000/circles/",
"projects": "http://localhost:8000/projects/",
"customers": "http://localhost:8000/customers/",
"users": "http://localhost:8000/users/"
},
"post": {
"circles": "http://localhost:8000/circles/",
"projects": "http://localhost:8000/projects/",
"customers": "http://localhost:8000/customers/",
"users": "http://localhost:8000/users/"
}
}
}

View File

@ -1,17 +1,15 @@
{ {
"xmpp": "https://jabber.happy-dev.fr/http-bind/", "xmpp": "https://jabber.happy-dev.fr/http-bind/",
"authority": "http://localhost:8000/", "authority": "http://localhost:8000/",
"clientLogo": "/images/logo.png",
"authorityName": "djangoldp-server-name",
"clientName": "Sib App", "clientName": "Sib App",
"clientLogo": "/images/logo.png",
"clientLogoHeight": "32px",
"clientCSS": "/path/to/custom.css",
"authorityName": "djangoldp-server-name",
"endpoints": { "endpoints": {
"businessproviders": "http://localhost:8000/businessproviders/",
"circles": "http://localhost:8000/circles/", "circles": "http://localhost:8000/circles/",
"groups": "http://localhost:8000/groups/",
"joboffers": "http://localhost:8000/job-offers/",
"projects": "http://localhost:8000/projects/", "projects": "http://localhost:8000/projects/",
"customers": "http://localhost:8000/customers/", "customers": "http://localhost:8000/customers/",
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/" "users": "http://localhost:8000/users/"
} }
} }

View File

@ -1,11 +1,6 @@
script(type="module" src="https://unpkg.com/@startinblox/oidc@0.8") script(type="module" src="https://unpkg.com/@startinblox/oidc@0.8")
script(src="/scripts/index.js") script(src="/scripts/index.js")
//- Stylesheets
link(rel='stylesheet', href='/styles/index.css')
link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,600,700&amp;subset=latin-ext')
link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i')
//- local //- local
//- script(type="module" src="/lib/sib-router/src/index.js") //- script(type="module" src="/lib/sib-router/src/index.js")
//- script(type="module" src="/lib/sib-chat/sib-chat.js") //- script(type="module" src="/lib/sib-chat/sib-chat.js")
@ -23,6 +18,11 @@ script(type="module" src="https://unpkg.com/@startinblox/component-notifications
//- script(type="module" src="https://unpkg.com/@startinblox/component-directory@0.3") //- script(type="module" src="https://unpkg.com/@startinblox/component-directory@0.3")
//- script(type="module" src="https://unpkg.com/@startinblox/component-job-board@0.3") //- script(type="module" src="https://unpkg.com/@startinblox/component-job-board@0.3")
//- Stylesheets
link(rel='stylesheet', href='/styles/index.css')
link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,600,700&amp;subset=latin-ext')
link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i')
//- Context - Fix for LDFlex //- Context - Fix for LDFlex
script(data-default-context, type="application/ld+json") script(data-default-context, type="application/ld+json")
| { | {

View File

@ -2,4 +2,4 @@
var __env = locals[process.env.ENV] var __env = locals[process.env.ENV]
for(k in __env){ for(k in __env){
eval(`var ${k} = __env[${JSON.stringify(k)}]`); eval(`var ${k} = __env[${JSON.stringify(k)}]`);
} }

View File

@ -31,7 +31,7 @@ button.notLoggedIn.mobile-menu-icon.icon-menu#toggleMainMenu
sib-auth sib-auth
sib-auth-provider( sib-auth-provider(
data-authority=`${authority}` data-authority=`${authority}`
data-id=`${authorityName || "paris"}` data-id=`${authorityName || "authority"}`
data-client-name=`${clientName || "SIB App"}` data-client-name=`${clientName || "SIB App"}`
) )

View File

@ -8,6 +8,8 @@ html(lang="en")
meta(http-equiv="X-UA-Compatible", content="ie=edge") meta(http-equiv="X-UA-Compatible", content="ie=edge")
link(rel="icon" type="image/png" href="/images/favicon.png") link(rel="icon" type="image/png" href="/images/favicon.png")
include dependencies.pug include dependencies.pug
if endpoints.clientCSS
link(rel='stylesheet', href=`${endpoints.clientCSS}`)
body body
header#header(role='banner') header#header(role='banner')
include header.pug include header.pug
@ -29,14 +31,17 @@ html(lang="en")
//- sib-link(class="backlink", next="job-offers") Back //- sib-link(class="backlink", next="job-offers") Back
//- include page-job-offer-edit.pug //- include page-job-offer-edit.pug
#project(hidden).with-sidebar if endpoints.projects || (endpoints.get && endpoints.get.projects)
include page-project.pug #project(hidden).with-sidebar
include page-project.pug
#circle(hidden).with-sidebar if endpoints.circles || (endpoints.get && endpoints.get.circles)
include page-circle.pug #circle(hidden).with-sidebar
include page-circle.pug
#messages(hidden).with-sidebar if endpoints.users || (endpoints.get && endpoints.get.users)
include page-messages.pug #messages(hidden).with-sidebar
include page-messages.pug
#admin(hidden).with-sidebar #admin(hidden).with-sidebar
include page-admin.pug include page-admin.pug

View File

@ -19,79 +19,83 @@ nav#main__menu.jsLeftMenu
//- sib-route(name='job-offer-create', hidden) //- sib-route(name='job-offer-create', hidden)
//- sib-route(name='job-offer-edit', use-id, hidden) //- sib-route(name='job-offer-edit', use-id, hidden)
//- div.divider //- div.divider
//- div if endpoints.projects || (endpoints.get && endpoints.get.projects)
//- div.menu div
//- div.menu-chevron div.menu
//- sib-link(next='admin-project-list') div.menu-chevron
//- div.menu-icon.icon-arrow-right sib-link(next='admin-project-list')
//- div.menu-label Projects div.menu-icon.icon-arrow-right
//- div.menu-icon.icon-folder-alt div.menu-label Projects
//- sib-route(name='project', rdf-type='hd:project', use-id='', hidden) div.menu-icon.icon-folder-alt
//- div.sub-menu.menu-notification sib-route(name='project', rdf-type='hd:project', use-id='', hidden)
//- sib-display.project-tab( div.sub-menu.menu-notification
//- data-src=`${endpoints.projects}` sib-display.project-tab(
//- fields='project(customer.name, name), badge' data-src=`${endpoints.projects || (endpoints.get && endpoints.get.projects)}`
//- class-customer.name='project-customer' fields='project(customer.name, name), badge'
//- class-name='project-name' class-customer.name='project-customer'
//- empty-widget='hd-create' class-name='project-name'
//- empty-value='project' empty-widget='hd-create'
//- search-fields='team' empty-value='project'
//- search-widget-team='sib-form-hidden' search-fields='team'
//- search-value-team='-' search-widget-team='sib-form-hidden'
//- hd-inherit-user-id='search-value-team' search-value-team='-'
//- hd-inherit-widgets hd-inherit-user-id='search-value-team'
//- widget-badge='hd-counter' hd-inherit-widgets
//- action-badge='badge' widget-badge='hd-counter'
//- order-by='customer.name' action-badge='badge'
//- next='project' order-by='customer.name'
//- ) next='project'
//- div.divider )
div div.divider
div.menu if endpoints.circles || (endpoints.get && endpoints.get.circles)
div.menu-chevron div
sib-link(next='admin-circle-list') div.menu
div.menu-icon.icon-arrow-right div.menu-chevron
div.menu-label Circles sib-link(next='admin-circle-list')
div.menu-icon.icon-folder-alt div.menu-icon.icon-arrow-right
sib-route(name='circle', rdf-type='hd:circle', use-id='', hidden) div.menu-label Circles
div.sub-menu.menu-notification div.menu-icon.icon-folder-alt
sib-widget(name='menu-circle-fix-url') sib-route(name='circle', rdf-type='hd:circle', use-id='', hidden)
template div.sub-menu.menu-notification
sib-display( sib-widget(name='menu-circle-fix-url')
data-src='${value}' template
fields='name, badge' sib-display(
value-badge='${value}' data-src='${value}'
widget-badge='hd-counter' fields='name, badge'
widget-name='sib-display-div' value-badge='${value}'
) widget-badge='hd-counter'
sib-display( widget-name='sib-display-div'
bind-user )
nested-field='circles' sib-display(
fields='circle' bind-user
empty-widget='hd-create' nested-field='circles'
empty-value='circle' fields='circle'
widget-circle='menu-circle-fix-url' empty-widget='hd-create'
order-by='circle.name' empty-value='circle'
next='circle' widget-circle='menu-circle-fix-url'
) order-by='circle.name'
div.divider next='circle'
div.menu-wrapper )
div.menu div.divider
div.menu-chevron if endpoints.users || (endpoints.get && endpoints.get.users)
div.menu-icon.icon-arrow-up div.menu-wrapper
div.menu-label Chat div.menu
div.menu-icon.icon-envelope-letter div.menu-chevron
sib-route(name='messages', rdf-type='foaf:user', use-id='', hidden) div.menu-icon.icon-arrow-up
div.sub-menu.menu-notification div.menu-label Chat
sib-display.nosub( div.menu-icon.icon-envelope-letter
data-src=`${endpoints.users}` sib-route(name='messages', rdf-type='foaf:user', use-id='', hidden)
fields='username, badge' div.sub-menu.menu-notification
widget-username='sib-display-div' sib-display.nosub(
widget-badge='hd-counter' data-src=`${endpoints.users || (endpoints.get && endpoints.get.users)}`
action-badge='badge' fields='username, badge'
order-by='username' widget-username='sib-display-div'
next='messages' widget-badge='hd-counter'
) action-badge='badge'
order-by='username'
next='messages'
)
div.divider
sib-route(name='admin', hidden) sib-route(name='admin', hidden)
//- div.divider //- div.divider

View File

@ -6,7 +6,7 @@ div.content-box__info
p.center Here you can create a new circle according to your interests, what you want to share, etc. p.center Here you can create a new circle according to your interests, what you want to share, etc.
sib-form.block( sib-form.block(
data-src=`${endpoints.circles}` data-src=`${endpoints.circles || endpoints.post.circles}`
fields='name, description' fields='name, description'

View File

@ -85,7 +85,7 @@
sib-display( sib-display(
class='table-body' class='table-body'
data-src=`${endpoints.circles}` data-src=`${endpoints.circles || endpoints.get.circles}`
fields='name, owner, buttons' fields='name, owner, buttons'
class-name='w33 cell border cell-with-name' class-name='w33 cell border cell-with-name'

View File

@ -10,7 +10,7 @@ div.content-box__info
sib-form( sib-form(
data-holder data-holder
fields='user, project' fields='user, project'
range-user=`${endpoints.users}` range-user=`${endpoints.users || endpoints.get.users}`
value-project='${src}' value-project='${src}'
widget-project='sib-form-hidden' widget-project='sib-form-hidden'
naked naked
@ -19,7 +19,7 @@ div.content-box__info
h1.centered New project h1.centered New project
sib-form.block( sib-form.block(
data-src=`${endpoints.projects}` data-src=`${endpoints.projects || endpoints.post.projects}`
fields='line-1(customer, name), line-3(project.description), fieldset-fee, line-4(businessProvider.name, businessProvider.fee), fieldset-captain, line-10(captain)' fields='line-1(customer, name), line-3(project.description), fieldset-fee, line-4(businessProvider.name, businessProvider.fee), fieldset-captain, line-10(captain)'
@ -33,7 +33,7 @@ div.content-box__info
label-customer='Customer' label-customer='Customer'
class-customer='member-select form-label is-light is-half-width' class-customer='member-select form-label is-light is-half-width'
range-customer=`${endpoints.customers}` range-customer=`${endpoints.customers || endpoints.get.customers}`
widget-customer='sib-form-auto-completion' widget-customer='sib-form-auto-completion'
label-name='Project\'s name*' label-name='Project\'s name*'
@ -49,7 +49,7 @@ div.content-box__info
label-businessProvider.fee='Amount of the contribution' label-businessProvider.fee='Amount of the contribution'
class-businessProvider.fee='form-label is-light is-half-width' class-businessProvider.fee='form-label is-light is-half-width'
range-captain=`${endpoints.users}` range-captain=`${endpoints.users || endpoints.get.users}`
class-captain='member-select form-label is-light is-half-width' class-captain='member-select form-label is-light is-half-width'
widget-captain='sib-form-auto-completion' widget-captain='sib-form-auto-completion'

View File

@ -70,7 +70,7 @@
sib-display( sib-display(
class='table-body' class='table-body'
data-src=`${endpoints.projects}` data-src=`${endpoints.projects || endpoints.get.projects}`
fields='name, members, captain, buttons' fields='name, members, captain, buttons'
class-name='w25 cell border cell-with-name hashtag' class-name='w25 cell border cell-with-name hashtag'

View File

@ -9,7 +9,7 @@
#admin-users-list(hidden) #admin-users-list(hidden)
div.content-box__info div.content-box__info
sib-display.block( sib-display.block(
data-src=`${endpoints.users}` data-src=`${endpoints.users || endpoints.get.users}`
fields="account.picture, name, username, email, groups" fields="account.picture, name, username, email, groups"
multiple-groups="" multiple-groups=""
) )

View File

@ -1,8 +1,10 @@
.views-container.sidebar-is-closed .views-container.sidebar-is-closed
#admin-circles(hidden) if endpoints.circles || (endpoints.get && endpoints.get.circles)
include page-admin-circles.pug #admin-circles(hidden)
#admin-projects(hidden) include page-admin-circles.pug
include page-admin-projects.pug if endpoints.projects || (endpoints.get && endpoints.get.projects)
#admin-projects(hidden)
include page-admin-projects.pug
//- #admin-users(hidden) //- #admin-users(hidden)
include page-admin-users.pug include page-admin-users.pug
nav.jsRightMenu(role='navigation') nav.jsRightMenu(role='navigation')
@ -13,9 +15,11 @@ nav.jsRightMenu(role='navigation')
//- sib-route(name='admin-users') //- sib-route(name='admin-users')
li li
a Users a Users
sib-route(name='admin-circles') if endpoints.circles || (endpoints.get && endpoints.get.circles)
li sib-route(name='admin-circles')
a Circles li
//- sib-route(name='admin-projects') a Circles
//- li if endpoints.projects || (endpoints.get && endpoints.get.projects)
//- a Projects sib-route(name='admin-projects')
li
a Projects

View File

@ -45,7 +45,7 @@ div.content-box__info
bind-resources bind-resources
fields='block-circle__info(name, owner), description' fields='block-circle__info(name, owner), description'
range-owner=`${endpoints.users}` range-owner=`${endpoints.users || endpoints.get.users}`
label-owner='owner' label-owner='owner'
label-description='circle subtitle' label-description='circle subtitle'
@ -69,7 +69,7 @@ div.content-box__info
bind-resources bind-resources
nested-field='members' nested-field='members'
fields='user' fields='user'
range-user=`${endpoints.users}` range-user=`${endpoints.users || endpoints.get.users}`
class-user='team form-label is-dark' class-user='team form-label is-dark'
label-user='' label-user=''

View File

@ -11,8 +11,8 @@
p Be specific and exhaustive to avoid answering too many questions later. Indicate what is the best way to fill the offer, the prerequisites...' p Be specific and exhaustive to avoid answering too many questions later. Indicate what is the best way to fill the offer, the prerequisites...'
sib-form.block( sib-form.block(
data-src=`${endpoints.joboffers}` data-src=`${endpoints.joboffers || endpoints.post.joboffers}`
range-skills=`${endpoints.skills}` range-skills=`${endpoints.skills || endpoints.get.skills}`
fields='title, title-text, description, description-text, skills, closingDate' fields='title, title-text, description, description-text, skills, closingDate'

View File

@ -3,7 +3,7 @@
sib-form.block( sib-form.block(
bind-resources bind-resources
range-skills=`${endpoints.skills}` range-skills=`${endpoints.skills || endpoints.get.skills}`
fields='title, description, skills, closingDate' fields='title, description, skills, closingDate'

View File

@ -1,7 +1,7 @@
.job-offers__container .job-offers__container
sib-job-board( sib-job-board(
data-src=`${endpoints.joboffers}`, data-src=`${endpoints.joboffers || endpoints.get.joboffers}`,
range-skills=`${endpoints.skills}` range-skills=`${endpoints.skills || endpoints.get.skills}`
) )
div.job-offers__newoffer div.job-offers__newoffer

View File

@ -1,6 +1,6 @@
sib-directory( sib-directory(
data-src=`${endpoints.users}`, data-src=`${endpoints.users || endpoints.get.users}`,
range-groups=`${endpoints.groups}`, range-groups=`${endpoints.groups || endpoints.get.groups}`,
range-skills=`${endpoints.skills}` range-skills=`${endpoints.skills || endpoints.get.skills}`
) )

View File

@ -21,7 +21,7 @@ div.content-box__info
class-description='form-label is-light is-full-width' class-description='form-label is-light is-full-width'
label-fieldset-info='' label-fieldset-info=''
label-customer='Customer' label-customer='Customer'
range-customer=`${endpoints.customers}` range-customer=`${endpoints.customers || endpoints.get.customers}`
label-name='Project\'s name*' label-name='Project\'s name*'
label-description='Project description' label-description='Project description'
widget-fieldset-info='hd-fieldset-title' widget-fieldset-info='hd-fieldset-title'
@ -44,7 +44,7 @@ div.content-box__info
bind-resources bind-resources
nested-field='members' nested-field='members'
fields='user' fields='user'
range-user=`${endpoints.users}` range-user=`${endpoints.users || endpoints.get.users}`
class-user='team form-label is-dark' class-user='team form-label is-dark'
label-user='' label-user=''

View File

@ -55,7 +55,7 @@ include templates/template-groups.pug
sib-form( sib-form(
bind-user='' bind-user=''
range-skills=`${endpoints.skills}` range-skills=`${endpoints.skills || endpoints.get.skills}`
fields='skills' fields='skills'
class-skills='form-label is-dark' class-skills='form-label is-dark'