diff --git a/src/includes/head.pug b/src/includes/head.pug index f56002384b93bcf66a10bee7f5c0df2fdbcfad72..2536f32032ead71c333d5ab3b88ea565350b6918 100644 --- a/src/includes/head.pug +++ b/src/includes/head.pug @@ -2,10 +2,10 @@ head title CoopStarter meta(charset="utf-8") script(src="https://unpkg.com/@webcomponents/webcomponentsjs@1.2.7/webcomponents-loader.js") - script(type="module" src="https://unpkg.com/@startinblox/core") - script(type="module" src="https://unpkg.com/@startinblox/router") - script(type="module" src="https://unpkg.com/@startinblox/oidc") - script(type="module" src="https://unpkg.com/@startinblox/component-conversation") + 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="https://unpkg.com/@startinblox/oidc@0.8") + script(type="module" src="https://unpkg.com/@startinblox/component-conversation@0.4") script(src="https://kit.fontawesome.com/48014d2af3.js") script(src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous") script(src="/scripts/coopstarter.js") @@ -17,4 +17,4 @@ head "mentorProfile": "http://happy-dev.fr/owl/#mentor_profile", "account": "http://happy-dev.fr/owl/#account" } - \ No newline at end of file + diff --git a/src/includes/mentor/components/header.pug b/src/includes/mentor/components/header.pug index b9f62c266201792bc21d830aaaf3db320307be27..6159b93594c758cda68367aa4a5cd1352414cc09 100644 --- a/src/includes/mentor/components/header.pug +++ b/src/includes/mentor/components/header.pug @@ -17,7 +17,7 @@ naked ) .dropdownWrapper - sib-display#mentor-account-picture.dropdownLabel( + sib-display#user-account-picture.dropdownLabel( bind-user fields='account.picture', widget-account.picture='cs-account-picture' diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 599e36fff089f4013c5373d08e6402e04316b11b..56f1a24335b97735dadec8f9b62d5b06cf12fe07 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -374,6 +374,22 @@ function initFileUpload(){ } } +/** + * Manage the like sender hidden form + * @param {*} event + * @param {*} userWhoSubmitLike + * @param {*} formSenderLike + */ +function fillSenderLike(userWhoSubmitLike, formSenderLike, currentResource) { + formSenderLike.querySelector( + "input[name='sender']" + ).value = JSON.stringify({ "@id": userWhoSubmitLike }); + formSenderLike.querySelector( + "input[name='receiver_object_id']" + ).value = JSON.stringify({ "@id": currentResource }); + receiver_object_id +} + /** * For entrepreneur dashboard only : * As we cannot have multiple imbricated filtering with the native sib-display, we manage it manually. @@ -402,11 +418,6 @@ function addProperFilterToSearchComponents(targetId) { `input[name="name_keyword"]` ); - let keyword_submit = baseElement.querySelectorAll(" .keyword_submit")[0]; - let keyword_hidden_fields = baseElement.querySelectorAll( - 'hidden-widget[name="search_for_a_resource"] input' - ); - if (keyword_field) { let keyword_submit = baseElement.querySelectorAll(" .keyword_submit")[0]; let keyword_hidden_fields = baseElement.querySelectorAll( @@ -576,6 +587,8 @@ jQuery(document).ready(function($) { linkDatasetToField(userAccountDataSrc, "improvement-dialog-form", "reviewer"); linkDatasetToField(userAccountDataSrc, "refusal-dialog-form", "reviewer"); linkDatasetToField(userAccountDataSrc, "change_status_request", "reviewer"); + // linkDatasetToField(userAccountDataSrc, "add-like", "sender"); + // linkDatasetToField(userAccountDataSrc, "add-dislike", "sender"); //On form submission, we sometime have to refresh a list. refreshList("resource-creation-form", "resources-history"); @@ -634,6 +647,34 @@ jQuery(document).ready(function($) { var userWhoSubmitReport = userAccountDataSrc.dataset.src var formBrokenLink = document.getElementById("report-broken-link-mentor"); fillReportBrokenLinkForm(event, userWhoSubmitReport, formBrokenLink); + + // Fill the hidden like-form + document.querySelector('sib-auth').getUser().then(data=> { + let targetFormLike = document.getElementById('add-like'); + targetFormLike.addEventListener("populate", event => { + let resourceField = targetFormLike.querySelector(`input[name="sender"]`); + if (resourceField) { + resourceField.value = JSON.stringify(data); + resourceField.setAttribute( + "value", + JSON.stringify(data) + ); + } + }); + let targetFormDislike = document.getElementById('add-dislike'); + targetFormDislike.addEventListener("populate", event => { + let resourceField = targetFormDislike.querySelector(`input[name="sender"]`); + if (resourceField) { + resourceField.value = JSON.stringify(data); + resourceField.setAttribute( + "value", + JSON.stringify(data) + ); + } + }); + + }) + }); //Init the form file behaviour diff --git a/src/styles/index.scss b/src/styles/index.scss index 44dfb453603426e27087863d26ecdf8d382ee01d..4cb69b477deaddfcb545f022d853a4d7c042624d 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -768,7 +768,6 @@ footer#footer{ background:var(--bg-block); height: auto; box-shadow: 0 2px 10px 0 rgba(0,0,0,0.14); - position: absolute; padding-top: 2rem; bottom: 0; width: 100%;