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:
* 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 SMTP Server (optional)
* NodeJS on your machine
Before diving in you have to check your SIB server supports the following LDP packages:
* djangoldp_account: 0.2.14
* djangoldp_circle: 0.1.15
* djangoldp_joboffer: 0.1.1
* djangoldp_notification: 0.1.4
* djangoldp_account: 0.2.24
* djangoldp_circle: 0.1.22
* djangoldp_notification: 0.1.7
* djangoldp_profile: 0.1.4
* djangoldp_project: 0.1.12
* djangoldp_skill: 0.1.1
* djangoldp_project: 0.1.26
* oidc_provider: 'git+https://github.com/jblemee/django-oidc-provider.git@develop'
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 ...
```
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
* groups
* joboffers
* projects
* skills
* users
Current Sib App capabilities:
[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:
@ -70,19 +69,3 @@ npm run watch
## Built With
* [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/",
"authority": "http://localhost:8000/",
"clientLogo": "/images/logo.png",
"authorityName": "djangoldp-server-name",
"clientName": "Sib App",
"clientLogo": "/images/logo.png",
"clientLogoHeight": "32px",
"clientCSS": "/path/to/custom.css",
"authorityName": "djangoldp-server-name",
"endpoints": {
"businessproviders": "http://localhost:8000/businessproviders/",
"circles": "http://localhost:8000/circles/",
"groups": "http://localhost:8000/groups/",
"joboffers": "http://localhost:8000/job-offers/",
"projects": "http://localhost:8000/projects/",
"customers": "http://localhost:8000/customers/",
"skills": "http://localhost:8000/skills/",
"users": "http://localhost:8000/users/"
}
}

View File

@ -1,11 +1,6 @@
script(type="module" src="https://unpkg.com/@startinblox/oidc@0.8")
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
//- script(type="module" src="/lib/sib-router/src/index.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-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
script(data-default-context, type="application/ld+json")
| {

View File

@ -2,4 +2,4 @@
var __env = locals[process.env.ENV]
for(k in __env){
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-provider(
data-authority=`${authority}`
data-id=`${authorityName || "paris"}`
data-id=`${authorityName || "authority"}`
data-client-name=`${clientName || "SIB App"}`
)

View File

@ -8,6 +8,8 @@ html(lang="en")
meta(http-equiv="X-UA-Compatible", content="ie=edge")
link(rel="icon" type="image/png" href="/images/favicon.png")
include dependencies.pug
if endpoints.clientCSS
link(rel='stylesheet', href=`${endpoints.clientCSS}`)
body
header#header(role='banner')
include header.pug
@ -29,14 +31,17 @@ html(lang="en")
//- sib-link(class="backlink", next="job-offers") Back
//- include page-job-offer-edit.pug
#project(hidden).with-sidebar
include page-project.pug
if endpoints.projects || (endpoints.get && endpoints.get.projects)
#project(hidden).with-sidebar
include page-project.pug
#circle(hidden).with-sidebar
include page-circle.pug
if endpoints.circles || (endpoints.get && endpoints.get.circles)
#circle(hidden).with-sidebar
include page-circle.pug
#messages(hidden).with-sidebar
include page-messages.pug
if endpoints.users || (endpoints.get && endpoints.get.users)
#messages(hidden).with-sidebar
include page-messages.pug
#admin(hidden).with-sidebar
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-edit', use-id, hidden)
//- div.divider
//- div
//- div.menu
//- div.menu-chevron
//- sib-link(next='admin-project-list')
//- div.menu-icon.icon-arrow-right
//- div.menu-label Projects
//- div.menu-icon.icon-folder-alt
//- sib-route(name='project', rdf-type='hd:project', use-id='', hidden)
//- div.sub-menu.menu-notification
//- sib-display.project-tab(
//- data-src=`${endpoints.projects}`
//- fields='project(customer.name, name), badge'
//- class-customer.name='project-customer'
//- class-name='project-name'
//- empty-widget='hd-create'
//- empty-value='project'
//- search-fields='team'
//- search-widget-team='sib-form-hidden'
//- search-value-team='-'
//- hd-inherit-user-id='search-value-team'
//- hd-inherit-widgets
//- widget-badge='hd-counter'
//- action-badge='badge'
//- order-by='customer.name'
//- next='project'
//- )
//- div.divider
div
div.menu
div.menu-chevron
sib-link(next='admin-circle-list')
div.menu-icon.icon-arrow-right
div.menu-label Circles
div.menu-icon.icon-folder-alt
sib-route(name='circle', rdf-type='hd:circle', use-id='', hidden)
div.sub-menu.menu-notification
sib-widget(name='menu-circle-fix-url')
template
sib-display(
data-src='${value}'
fields='name, badge'
value-badge='${value}'
widget-badge='hd-counter'
widget-name='sib-display-div'
)
sib-display(
bind-user
nested-field='circles'
fields='circle'
empty-widget='hd-create'
empty-value='circle'
widget-circle='menu-circle-fix-url'
order-by='circle.name'
next='circle'
)
div.divider
div.menu-wrapper
div.menu
div.menu-chevron
div.menu-icon.icon-arrow-up
div.menu-label Chat
div.menu-icon.icon-envelope-letter
sib-route(name='messages', rdf-type='foaf:user', use-id='', hidden)
div.sub-menu.menu-notification
sib-display.nosub(
data-src=`${endpoints.users}`
fields='username, badge'
widget-username='sib-display-div'
widget-badge='hd-counter'
action-badge='badge'
order-by='username'
next='messages'
)
if endpoints.projects || (endpoints.get && endpoints.get.projects)
div
div.menu
div.menu-chevron
sib-link(next='admin-project-list')
div.menu-icon.icon-arrow-right
div.menu-label Projects
div.menu-icon.icon-folder-alt
sib-route(name='project', rdf-type='hd:project', use-id='', hidden)
div.sub-menu.menu-notification
sib-display.project-tab(
data-src=`${endpoints.projects || (endpoints.get && endpoints.get.projects)}`
fields='project(customer.name, name), badge'
class-customer.name='project-customer'
class-name='project-name'
empty-widget='hd-create'
empty-value='project'
search-fields='team'
search-widget-team='sib-form-hidden'
search-value-team='-'
hd-inherit-user-id='search-value-team'
hd-inherit-widgets
widget-badge='hd-counter'
action-badge='badge'
order-by='customer.name'
next='project'
)
div.divider
if endpoints.circles || (endpoints.get && endpoints.get.circles)
div
div.menu
div.menu-chevron
sib-link(next='admin-circle-list')
div.menu-icon.icon-arrow-right
div.menu-label Circles
div.menu-icon.icon-folder-alt
sib-route(name='circle', rdf-type='hd:circle', use-id='', hidden)
div.sub-menu.menu-notification
sib-widget(name='menu-circle-fix-url')
template
sib-display(
data-src='${value}'
fields='name, badge'
value-badge='${value}'
widget-badge='hd-counter'
widget-name='sib-display-div'
)
sib-display(
bind-user
nested-field='circles'
fields='circle'
empty-widget='hd-create'
empty-value='circle'
widget-circle='menu-circle-fix-url'
order-by='circle.name'
next='circle'
)
div.divider
if endpoints.users || (endpoints.get && endpoints.get.users)
div.menu-wrapper
div.menu
div.menu-chevron
div.menu-icon.icon-arrow-up
div.menu-label Chat
div.menu-icon.icon-envelope-letter
sib-route(name='messages', rdf-type='foaf:user', use-id='', hidden)
div.sub-menu.menu-notification
sib-display.nosub(
data-src=`${endpoints.users || (endpoints.get && endpoints.get.users)}`
fields='username, badge'
widget-username='sib-display-div'
widget-badge='hd-counter'
action-badge='badge'
order-by='username'
next='messages'
)
div.divider
sib-route(name='admin', hidden)
//- 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.
sib-form.block(
data-src=`${endpoints.circles}`
data-src=`${endpoints.circles || endpoints.post.circles}`
fields='name, description'

View File

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

View File

@ -10,7 +10,7 @@ div.content-box__info
sib-form(
data-holder
fields='user, project'
range-user=`${endpoints.users}`
range-user=`${endpoints.users || endpoints.get.users}`
value-project='${src}'
widget-project='sib-form-hidden'
naked
@ -19,7 +19,7 @@ div.content-box__info
h1.centered New project
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)'
@ -33,7 +33,7 @@ div.content-box__info
label-customer='Customer'
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'
label-name='Project\'s name*'
@ -49,7 +49,7 @@ div.content-box__info
label-businessProvider.fee='Amount of the contribution'
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'
widget-captain='sib-form-auto-completion'

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ div.content-box__info
bind-resources
fields='block-circle__info(name, owner), description'
range-owner=`${endpoints.users}`
range-owner=`${endpoints.users || endpoints.get.users}`
label-owner='owner'
label-description='circle subtitle'
@ -69,7 +69,7 @@ div.content-box__info
bind-resources
nested-field='members'
fields='user'
range-user=`${endpoints.users}`
range-user=`${endpoints.users || endpoints.get.users}`
class-user='team form-label is-dark'
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...'
sib-form.block(
data-src=`${endpoints.joboffers}`
range-skills=`${endpoints.skills}`
data-src=`${endpoints.joboffers || endpoints.post.joboffers}`
range-skills=`${endpoints.skills || endpoints.get.skills}`
fields='title, title-text, description, description-text, skills, closingDate'

View File

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

View File

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

View File

@ -1,6 +1,6 @@
sib-directory(
data-src=`${endpoints.users}`,
range-groups=`${endpoints.groups}`,
range-skills=`${endpoints.skills}`
data-src=`${endpoints.users || endpoints.get.users}`,
range-groups=`${endpoints.groups || endpoints.get.groups}`,
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'
label-fieldset-info=''
label-customer='Customer'
range-customer=`${endpoints.customers}`
range-customer=`${endpoints.customers || endpoints.get.customers}`
label-name='Project\'s name*'
label-description='Project description'
widget-fieldset-info='hd-fieldset-title'
@ -44,7 +44,7 @@ div.content-box__info
bind-resources
nested-field='members'
fields='user'
range-user=`${endpoints.users}`
range-user=`${endpoints.users || endpoints.get.users}`
class-user='team form-label is-dark'
label-user=''

View File

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