From 7505e976701cc8191e8499c7a60f7eacde00d3ee Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@happy-dev.fr> Date: Wed, 20 May 2020 10:05:30 +0200 Subject: [PATCH] Fixing the context --- src/includes/head.pug | 25 +++++++++++++------------ src/scripts/coopstarter.js | 2 +- src/scripts/dispatch-space-n-user.js | 12 ++++++------ 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/includes/head.pug b/src/includes/head.pug index c0096526..0b189265 100644 --- a/src/includes/head.pug +++ b/src/includes/head.pug @@ -3,7 +3,7 @@ head meta(charset="utf-8") script(src="https://unpkg.com/@webcomponents/webcomponentsjs@1.2.7/webcomponents-loader.js") //- script(type="module" src="/scripts/sib-core/dist/index.js") - script(type="module" src="https://unpkg.com/@startinblox/core@0.9.27") + script(type="module" src="https://unpkg.com/@startinblox/core@0.9") script(type="module" src="https://unpkg.com/@startinblox/router@0.7") //- script(type="module" src="/scripts/sib-auth/index.js") script(type="module" src="https://unpkg.com/@startinblox/oidc@0.8") @@ -20,15 +20,16 @@ head id="1" ) - script(data-default-context type="application/ld+json" ). - - { - "entrepreneurProfile": "http://happy-dev.fr/owl/#entrepreneur_profile", - "mentorProfile": "http://happy-dev.fr/owl/#mentor_profile", - "account":"hd:account", - "messageSet":"http://happy-dev.fr/owl/#message_set", - "author":"http://happy-dev.fr/owl/#author_user", - "title":"http://happy-dev.fr/owl/#title", - "picture":"foaf:depiction" - } + script(data-default-context, type="application/ld+json"). + + { + "entrepreneurProfile": "http://happy-dev.fr/owl/#entrepreneur_profile", + "mentorProfile": "http://happy-dev.fr/owl/#mentor_profile", + "inbox": "http://happy-dev.fr/owl/#inbox", + "object": "http://happy-dev.fr/owl/#object", + "author": "http://happy-dev.fr/owl/#author_user", + "account": "http://happy-dev.fr/owl/#account", + "jabberID": "foaf:jabberID", + "picture": "foaf:depiction" + } diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index f128b93f..071b75c2 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -176,8 +176,8 @@ function selectHiddenManagement(select_hidden, option_selected) { //Removing the selected attribute from previous selection option_hidden.removeAttribute("selected"); if (option_hidden.value == option_selected.value) { + //Actually selecting the option if it is the good one - // option_hidden.setAttribute("selected", "selected"); select_hidden.value = option_selected.value; break; } diff --git a/src/scripts/dispatch-space-n-user.js b/src/scripts/dispatch-space-n-user.js index 0049a14e..5cb93bda 100644 --- a/src/scripts/dispatch-space-n-user.js +++ b/src/scripts/dispatch-space-n-user.js @@ -1,4 +1,4 @@ -import { store } from 'https://unpkg.com/@startinblox/core@0.9.27'; +import { store } from 'https://unpkg.com/@startinblox/core@0.9'; const sibAuth = document.querySelector('sib-auth'); const context = { @@ -14,8 +14,9 @@ const context = { geo: "http://www.w3.org/2003/01/geo/wgs84_pos#", lat: "geo:lat", lng: "geo:long", - 'mentor_profile': 'http://happy-dev.fr/owl/#mentor_profile', - 'entrepreneur_profile': 'http://happy-dev.fr/owl/#entrepreneur_profile', + 'picture': 'foaf:depiction', + 'mentorProfile': 'http://happy-dev.fr/owl/#mentor_profile', + 'entrepreneurProfile': 'http://happy-dev.fr/owl/#entrepreneur_profile' }; //We create a custom element @@ -55,7 +56,6 @@ class CoopStarterLoginComponent extends HTMLElement { return; } - // console.log("Users get from the store", user); // Set a userprefix default status var userPrefix = "public" @@ -65,8 +65,8 @@ class CoopStarterLoginComponent extends HTMLElement { let userFromStore = await store.get(user['@id']); // If the user is a mentor or an entreprenur, change user prefix if(userFromStore) { - let is_mentor = await userFromStore.mentor_profile; - let is_entrepreneur = await userFromStore.entrepreneur_profile; + let is_mentor = await userFromStore.mentorProfile; + let is_entrepreneur = await userFromStore.entrepreneurProfile; if (is_mentor) { userPrefix = "mentor" } else if(is_entrepreneur) { -- GitLab