Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • applications/knowledge-base/knowledgebase-front
  • HannaP/knowledgebase-front
  • novalore/knowledgebase-front
3 results
Show changes
Commits on Source (20)
Showing
with 192 additions and 115 deletions
......@@ -8,6 +8,7 @@
/dist/lib/
/dist/oidc-client-config.json
*.iml
/www/
/www/*
!/www/index.html
package-lock.json
const path = require('path')
const fs = require('fs').promises
const objectAssignDeep = require(`object-assign-deep`)
const yaml = require('js-yaml')
const pug = require('pug')
const chokidar = require('chokidar')
//Set default language
const default_lang = 'en'
const pugFile = './src/index.pug'
//Set the translation directory
const dataDir = './translation'
const outDir = './www'
//Compile custom function
async function compile() {
//Retrieve langues proposed
const langs = (await fs.readdir(dataDir))
.filter(f => path.extname(f) === '.yml')
.map(f => path.basename(f, '.yml'))
const langData = {}
//Retrieve traduction
await Promise.all(
langs.map(lang =>
fs
.readFile(`${dataDir}/${lang}.yml`, 'utf8')
.then(text => (langData[lang] = yaml.safeLoad(text))),
),
)
for (const lang in langData) {
if (lang === default_lang) continue
langData[lang] = objectAssignDeep(
{},
langData[default_lang],
langData[lang],
)
}
const options = JSON.parse(await fs.readFile('./src/config.json', 'utf-8'))
const pugFct = pug.compileFile(pugFile)
await fs.mkdir(outDir, { recursive: true })
//Creation of folders by language with their index.html dans wwww
await Promise.all(
Object.entries(langData).map(async([lang, data]) => {
const opt = Object.assign({}, options, { lang, data });
const dir = `${outDir}/${lang}`
await fs.mkdir(dir, { recursive: true })
const html = pugFct(opt)
const filename = `${dir}/index.html`
console.log(`write ${filename}`)
return fs.writeFile(filename, html)
}),
)
}
// Compile with --watch option
compile().then(() => {
if (!process.argv.includes('-w') && !process.argv.includes('--watch')) return
console.log('watching for changes…')
chokidar.watch([pugFile, dataDir]).on('change', editedFilePath => {
console.log(`\nchanged: ${editedFilePath}`)
compile()
})
})
......@@ -5,7 +5,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"scss": "node-sass -w ./src/styles/index.scss -o ./www/styles/",
"pug": "pug --watch ./src/index.pug --out ./www/ --obj ./src/config.json",
"pug": "node ./compile-pug.js -w",
"pugprod": "pug ./src/index.pug --out ./www/ --obj prod.json",
"copy-js": "cp ./src/scripts/*.js ./www/scripts/",
"copy-fonts": "cp -R ./src/fonts ./www",
......@@ -21,13 +21,17 @@
"@babel/core": "^7.1.0",
"@babel/cli": "^7.1.0",
"node-sass": "^4.9.3",
"pug-cli": "^1.0.0-alpha6",
"browser-sync": "^2.24.7",
"express": "^4.16.3"
"express": "^4.16.3",
"chokidar": "^3.2.3",
"js-yaml": "^3.13.1",
"object-assign-deep": "^0.4.0",
"pug": "^2.0.4"
},
"dependencies": {
"@webcomponents/html-imports": "^1.2.0",
"@webcomponents/webcomponentsjs": "^1.2.7",
"cookie-parser": "^1.4.4",
"include-media": "^1.4.9",
"normalize.css": "^8.0.0",
"onchange": "^6.1.0",
......
......@@ -9,9 +9,9 @@ const app = express();
app
.use(express.static(distPath))
// .use('/src', express.static(join(__dirname, 'src')))
.get(/^[^.]*$/, (req, rep) =>
rep.sendFile(join(__dirname, distPath, '/index.html'))
)
.get('/:lang/:path([^.]*)', (req, rep) => {
rep.sendFile(join(__dirname, distPath, `${req.params.lang}/index.html`));
})
.listen(port);
// browser sync
......
......@@ -7,21 +7,21 @@ sib-router(default-route='account-creation-index')
figure(class="logo")
img(src="../images/logo.png" alt="Coopstarter logo")
h2.title_lead Welcome to our international index of resources for cooperative mentors and entrepreneurs
h2.title_lead=`${data.welcome}`
sib-link.block_log(next='mentor-new-account')
div
figure.img_log
img(src="../images/mentor.png"
alt="Create your account as mentor")
h2.button_base I am a mentor
h2.button_base=`${data.IAmMentor}`
sib-link.block_log(next='entrepreneur-new-account')
div
figure.img_log
img(src="../images/fusee.png"
alt="Create your account as entrepreneur")
h2.button_base I am an entrepreneur
h2.button_base=`${data.IAmEntrepreneur}`
#mentor-new-account(hidden).no-sidebar.container
include mentor/profile/create.pug
......
......@@ -7,7 +7,7 @@
include menu.pug
div.flex.flex_espace.flex_item_center
sib-form(
sib-form.languageChoic(
data-src=`${endpoints.languages}`
fields='languages'
range-languages=`${endpoints.languages}`
......@@ -27,10 +27,10 @@
ul
li
sib-link(next='entrepreneur-dashboard')
p Dashboard
p= data.Dashboard
li
sib-link(next='entrepreneur-account')
p My account
p= data.MyAccount
li
a.logout-button
p Logout
\ No newline at end of file
p= data.Logout
\ No newline at end of file
......@@ -28,7 +28,7 @@ section#home
include ./requests/create.pug
dialog#entrepreneur-request-validation.no-sidebar.container
p You request has been submitted
p=`${data.YouRequestHasBeenSubmitted}`
p.flex
sib-link(next='entrepreneur-resource-list', class='button_base') Ok
......
div.container_min
h2.title_lead.fd_bleu Edit your account
h2.title_lead.fd_bleu= data.EditYourAccount
p.p_entete Your modifications have properly been saved.
p.p_entete= data.ModificationsProperlySaved
div
div.flex
h3.button_base
sib-link(next='entrepreneur-resource-list') -> Back to the database
\ No newline at end of file
sib-link(next='entrepreneur-resource-list')= data.BackToDashboard
\ No newline at end of file
......@@ -8,7 +8,7 @@ figure.logo.img_log
img(src="../images/fusee.png"
alt="Create an entrepreneur account")
h2.title_create Complete your entrepreneur account
h2.title_create=`${data.CompleteEntrepreneurAccount}`
sib-form#entrepreneur_profile_creation.block_log.block_creat_count(
bind-user
......@@ -16,9 +16,9 @@ sib-form#entrepreneur_profile_creation.block_log.block_creat_count(
range-entrepreneur_profile.organisation=`${endpoints.organisations}`
label-first_name="Surname"
label-last_name="Name"
label-entrepreneur_profile.organisation="Organisation *"
label-first_name=`${data.Surname}`
label-last_name=`${data.Name}`
label-entrepreneur_profile.organisation=`${data.Organisation}`
class-entrepreneur_profile.organisation='form-label is-dark'
widget-entrepreneur_profile.organisation='sib-form-auto-completion'
......@@ -29,7 +29,7 @@ sib-form#entrepreneur_profile_creation.block_log.block_creat_count(
widget-account.picture='cs-form-file-custom'
class-account.picture='input_photo w_25'
submit-button="COMPLETE YOUR ACCOUNT"
submit-button=`${data.CompleteYourAccount}`
next="entrepreneur-dashboard"
)
include ../../components/widgets
div.container_min
h2.title_lead.fd_bleu My Account
h2.title_lead.fd_bleu=`${data.MyAccount}`
div.block_list.flex
div.button__actions.w_25
div.dashboard__database
sib-link(next='entrepreneur-database')
div.button_base.ico_gauche.ico_database Browse database
div.button_base.ico_gauche.ico_database=`${data.BrowseDatabase}`
div.dashboard__database
sib-link(next='entrepreneur-resource-list')
div.button_base.ico_gauche.ico_search Back to dashboard
div.button_base.ico_gauche.ico_search=`${data.BackToDashboard}`
div.dashboard__database
div.logout-button.button_base(
role='log out'
) Logout
)=`${data.Logout}`
div.profile_information.block_log.w_75
sib-link(next='entrepreneur-account-edit')
......@@ -35,7 +35,7 @@ div.block_list.flex
sib-display#entrepreneur_contact(
bind-user
fields='email'
label-email='Email:'
label-email=`${data.Email}`
class-email="contact_profil"
widget-email='cs-display-resource-property'
)
\ No newline at end of file
include ../../components/widgets
h2.title_create Edit your account
h2.title_create= data.EditYourAccount
sib-form#entrepreneur_profile_edition.block_log.block_creat_count(
bind-user
fields="info(last_name, first_name, username, email, entrepreneur_profile.organisation, account.picture)"
range-entrepreneur_profile.organisation=`${endpoints.organisations}`
label-first_name="Surname"
label-last_name="Name"
label-entrepreneur_profile.organisation="Organisation"
label-account.picture="Profile picture"
label-first_name=`${data.Surname}`
label-last_name=`${data.Name}`
label-entrepreneur_profile.organisation=`${data.Organisation}`
label-account.picture=`${data.Photo}`
widget-username="sib-form-hidden"
class-last_name='form-label is-dark input_big'
......@@ -25,8 +25,8 @@ sib-form#entrepreneur_profile_edition.block_log.block_creat_count(
widget-account.picture='cs-form-file-custom'
class-account.picture='input_photo w_25'
submit-button="Save modifications"
submit-button=`${data.SaveModification}`
next='entrepreneur-account-edit-confirmation'
)
sib-link(class="backlink", next="entrepreneur-resource-list") Back to the dashboard
\ No newline at end of file
sib-link(class="backlink", next="entrepreneur-resource-list")= data.BackToDashboard
\ No newline at end of file
......@@ -4,11 +4,12 @@
p.backlink
i.fas.fa-times
div#resource-creation-form-loader
hidden Loading form, please wait...
hidden
i.fas.fa-spinner.fa-spin
h2.title_form Request a ressource
h2.title_form=`${data.RequestRessource}`
p.p_entete You can't find a resource you are looking for ? You need resources to acquire certain skills or progress in your cooperative developement ? It can be a book, a document model, a tutorial, anything you need, make a request to our mentors so they know how to help you.
p.p_entete=`${data.RequestRessourceInfo}`
img(src="../images/asid_entre.png" alt="rechercher de ressources")
sib-form#resource-creation-form(
......@@ -25,16 +26,16 @@
range-organisation=`${endpoints.organisations}`
range-country=`${endpoints.countries}`
label-header_mandatory='Mandatory information'
label-header_complementary='Complementary information'
label-header_mandatory=`${data.MandatoryInformation}`
label-header_complementary=`${data.ComplementaryInformation}`
label-name='Title*'
label-description='Description'
label-language='Language*'
label-country='Country*'
label-field='Field*'
label-organisation='Organisation'
label-skills='What do you need to learn with this resource ?'
label-name=`${data.TitleRequired}`
label-description=`${data.Description}`
label-language=`${data.Language}`
label-country=`${data.Country}`
label-field=`${data.FieldRequired}`
label-organisation=`${data.Organisation}`
label-skills=`${data.SkillToLearn}`
multiple-fields='sib-multiple-select'
widget-fields='sib-form-auto-completion'
......@@ -47,7 +48,7 @@
widget-skills='sib-form-textarea'
widget-organisation='sib-form-auto-completion'
submit-button='Send request'
submit-button=`${data.SendRequest}`
next="entrepreneur-request-validation"
)
......
......@@ -46,31 +46,31 @@ include ../../components/widgets
class-review.reviewer.name="validator_ressource"
widget-header_specifications='cs-section_header'
label-broken='Report broken link'
label-sharing='Access:'
label-language.name='Language:'
label-publication_year='Year of publication:'
label-header_specifications='Resource specifications'
label-broken=`${data.ReportBrokenLink}`
label-sharing=`${data.Access}`
label-language.name=`${data.Language}`
label-publication_year=`${data.DatePublication}`
label-header_specifications=`${data.ResourceSpecifications}`
class-format.name='format_type'
label-format.name=''
widget-steps='cs-display-step-property'
label-steps=''
each-label-steps="Step"
each-label-steps=`${data.Step}`
multiple-steps
widget-fields='cs-display-multiple-property'
label-fields=''
each-label-fields='Field:'
each-label-fields=`${data.Field}`
multiple-fields
label-skills='With this resource, you will be able to:'
label-uri='Link to resource'
label-skills=`${data.WithThisResourceBeAbleTo}`
label-uri=`${data.LinkToResource}`
name-uri='original-link'
label-country.name='Country:'
label-submitter.mentor_profile.organisation.name='Organisation:'
label-author='Author :'
label-submitter.name='Resource posted by:'
label-country.name=`${data.Country}`
label-submitter.mentor_profile.organisation.name=`${data.Organisation}`
label-author=`${data.Author}`
label-submitter.name=`${data.ResourcePostedBy}`
action-broken='resource-report-broken-link-entrepreneur'
)
......@@ -98,7 +98,7 @@ include ../../components/widgets
bind-resources
fields=""
nested-field="conversations"
counter-template="<p>Comments (${counter})</p>"
counter-template=`<p>${data.Comments} (${counter})</p>`
)
sib-conversation(
......@@ -106,7 +106,7 @@ include ../../components/widgets
id-suffix="conversations"
)
h2.title_lead_avenir Related resources
h2.title_lead_avenir=`${data.RelatedResources}`
sib-display(
bind-resources,
......
......@@ -7,8 +7,8 @@ dialog#resource-report-broken-link-entrepreneur
include ./resource-report-broken-link-entrepreneur
div.container_min
h2.title_lead.fd_bleu International index of resources for cooperative mentors and entrepreneurs
button.button_dark.pull-right Watch the presentation
h2.title_lead.fd_bleu=`${data.generalLabel}`
button.button_dark.pull-right=`${data.WatchThePresentation}`
i.far.fa-play-circle
//-About :
......@@ -19,7 +19,7 @@ container.block_list
div.flex.flex_espace
div.w_75.block-g-entre
div
h2.title_form Search for a resource
h2.title_form=`${data.SearchForResource}`
div#resources-loader
hidden
i.fas.fa-spinner.fa-spin
......@@ -27,13 +27,13 @@ container.block_list
data-src=`${endpoints.resources}`,
loader-id="resources-loader"
fields='keyword(name_keyword)'
label-name_keyword="Search by name..."
label-name_keyword=`${data.SearchByNam}`
widget-name_keyword="sib-form-placeholder-text"
naked
)
div.keyword_submit.button__actions
div.button_base.ico_gauche Search
div.button_base.ico_gauche=`${data.Search}`
sib-form.instance_database_only(
data-src=`${endpoints.resources}`,
......@@ -47,12 +47,12 @@ container.block_list
sib-form.more_criterias.flex.flex_espace(
data-src=`${endpoints.resources}`,
fields='header_criterias, format, publication_year, country, language, fields'
label-header_criterias='More criterias'
label-format='Format:'
label-publication_year='Year of publication'
label-country='Country of publication'
label-language='Language'
label-fields='Field'
label-header_criterias=`${data.Search}`
label-format=`${data.Format}`
label-publication_year=`${data.DatePublication}`
label-country=`${data.CountryPublication}`
label-language=`${data.Language}`
label-fields=`${data.Field}`
widget-header_criterias='cs-section_header'
range-language=`${endpoints.languages}`
......@@ -78,11 +78,11 @@ container.block_list
div.w_25
div.block_aside_entre
img(src="../images/asid_entre.png" alt="rechercher de ressources")
p Can't find the ressource you need ?
p=`${data.CantFindRessourceYouNeed}`
div.button__actions
sib-link(next='entrepreneur-request-create')
div
div.button_base Make a request
div.button_base=`${data.MakeRequest}`
//Fake tabs to filter by type.
......@@ -115,7 +115,7 @@ container.block_list
fields='name'
class="accordion active"
label-name ='Step 1 '
label-name =`${data.Step} 1 `
label-resources=''
widget-name='cs-steps-header'
......@@ -171,7 +171,7 @@ container.block_list
fields='name'
class="accordion"
label-name ='Step 2 '
label-name =`${data.Step} 2 `
label-resources=''
widget-name='cs-steps-header'
......@@ -225,7 +225,7 @@ container.block_list
fields='name'
class="accordion"
label-name ='Step 3 '
label-name =`${data.Step} 3 `
label-resources=''
widget-name='cs-steps-header'
......@@ -279,7 +279,7 @@ container.block_list
fields='name'
class="accordion"
label-name ='Step 4 '
label-name =`${data.Step} 4 `
label-resources=''
widget-name='cs-steps-header'
......@@ -335,7 +335,7 @@ container.block_list
fields='name'
class="accordion"
label-name ='Step 5 '
label-name =`${data.Step} 5 `
label-resources=''
widget-name='cs-steps-header'
......@@ -390,7 +390,7 @@ container.block_list
fields='name'
class="accordion"
label-name ='Step 6 '
label-name =`${data.Step} 6 `
label-resources=''
widget-name='cs-steps-header'
......@@ -438,3 +438,4 @@ container.block_list
paginate-by="5"
)
......@@ -4,8 +4,8 @@
p
i.fas.fa-times
h2.title_lead_avenir Thanks!
p The submitter of the resource will be advised that this link is broken.
h2.title_lead_avenir=`${data.Thanks}`
p=`${data.ConfirmSendBrokenLink}`
sib-form#report-broken-link-entrepreneur(
data-src=`${endpoints.brokenlinks}`
fields = "resource, submitter"
......
......@@ -2,8 +2,8 @@ include ../components/widgets
div.container_min
h2.title_lead.fd_bleu International index of resources for cooperative mentors and entrepreneurs
button.button_dark.pull-right Watch the presentation
h2.title_lead.fd_bleu=`${data.generalLabel}`
button.button_dark.pull-right= `${data.WatchThePresentation}`
i.far.fa-play-circle
div.block_list
......@@ -11,17 +11,17 @@ div.block_list
div.resources__newresource
sib-link(next='mentor-resource-create')
div
div.button_base.ico_gauche.ico_plus Post a new Resource
div.button_base.ico_gauche.ico_plus= `${data.PostResource}`
div.dashboard__database
sib-link(next='mentor-resource-list')
div.button_base.ico_gauche.ico_database Back to dashboard
div.button_base.ico_gauche.ico_database= `${data.BackToDashboard}`
container.block_list.flex.flex_espace
div.w_75.block-g-entre
div
h2.title_form Search for a resource
h2.title_form= `${data.SearchForResource}`
div#resources-mentor-database-loader
hidden
i.fas.fa-spinner.fa-spin
......@@ -30,14 +30,14 @@ container.block_list.flex.flex_espace
data-src=`${endpoints.resources}`,
loader-id="resources-mentor-database-loader"
fields='keyword(name_keyword)'
label-name_keyword="Search by name..."
label-name_keyword=`${data.SearchByNam}`
widget-name_keyword="sib-form-placeholder-text"
naked
)
div.keyword_submit.button__actions
div.button_base.ico_gauche Search
div.button_base.ico_gauche=`${data.Search}`
sib-form.instance_database_only(
data-src=`${endpoints.resources}`,
......@@ -50,12 +50,12 @@ container.block_list.flex.flex_espace
sib-form.more_criterias.flex.flex_espace(
data-src=`${endpoints.resources}`,
fields='header_criterias, format, publication_year, country, language, fields'
label-header_criterias='More criterias'
label-format='Format:'
label-publication_year='Year of publication'
label-country='Country of publication'
label-language='Language'
label-fields='Field'
label-header_criterias=`${data.MoreCriterias}`
label-format=`${data.Format}`
label-publication_year=`${data.DatePublication}`
label-country=`${data.CountryPublication}`
label-language=`${data.Language}`
label-fields=`${data.Field}`
widget-header_criterias='cs-section_header'
range-language=`${endpoints.languages}`
......@@ -108,7 +108,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion active"
label-name ='Step 1 '
label-name =`${data.Step} 1`,
label-resources=''
widget-name='cs-steps-header'
......@@ -162,7 +162,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion"
label-name ='Step 2 '
label-name =`${data.Step} 2`,
label-resources=''
widget-name='cs-steps-header'
......@@ -216,7 +216,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion"
label-name ='Step 3 '
label-name =`${data.Step} 3`,
label-resources=''
widget-name='cs-steps-header'
......@@ -271,7 +271,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion"
label-name ='Step 4 '
label-name =`${data.Step} 4`,
label-resources=''
widget-name='cs-steps-header'
......@@ -326,7 +326,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion"
label-name ='Step 5 '
label-name =`${data.Step} 5`,
label-resources=''
widget-name='cs-steps-header'
......@@ -380,7 +380,7 @@ container.block_list.flex.flex_espace
fields='name'
class="accordion"
label-name ='Step 6 '
label-name =`${data.Step} 6`,
label-resources=''
widget-name='cs-steps-header'
......
......@@ -7,7 +7,7 @@
include menu.pug
div.flex.flex_espace.flex_item_center
sib-form(
sib-form.languageChoice(
data-src=`${endpoints.languages}`
fields='languages'
range-languages=`${endpoints.languages}`
......@@ -16,7 +16,6 @@
label-languages=''
naked
)
.dropdownWrapper
sib-display#mentor-account-picture.dropdownLabel(
bind-user
......@@ -27,13 +26,13 @@
ul
li
sib-link(next='mentor-dashboard')
p Dashboard
p= data.Dashboard
li
sib-link(next='mentor-database')
p Resources database
p= data.ResourcesDatabase
li
sib-link(next='mentor-account')
p My account
p= data.MyAccount
li
a.logout-button
p Logout
\ No newline at end of file
p= data.Logout
\ No newline at end of file
sib-router(default-route='mentor-resource-list')
sib-router(default-route='mentor-resource-list' route-prefix=lang)
sib-route(name='mentor-resource-list')
sib-route(name='mentor-account', id-prefix=`${endpoints.users}`, use-id)
sib-route(name='mentor-account-edit', id-prefix=`${endpoints.users}`, use-id)
......
......@@ -33,11 +33,11 @@ section#home
include ./browseDatabase.pug
#mentor-resource-create(hidden).no-sidebar.container
sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard
sib-link(class="backlink", next="mentor-resource-list")=`${data.BackToDashboard}`
include resources/create.pug
#mentor-resource-edit(hidden).no-sidebar.container
sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard
sib-link(class="backlink", next="mentor-resource-list")=`${data.BackToDashboard}`
include resources/edit.pug
#resource-creation-confirmation(hidden).no-sidebar.container
......
div.container_min
h2.title_lead.fd_bleu Edit your account
h2.title_lead.fd_bleu= data.EditYourAccount
p.p_entete Your modifications have properly been saved.
p.p_entete= data.ModificationsProperlySaved
div
div.flex
h3.button_base
sib-link(next='mentor-resource-list') -> Back to dashboard
\ No newline at end of file
sib-link(next='mentor-resource-list')= data.BackToDashboard
\ No newline at end of file