diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index 8c22bbecb20fd6ae51409935be919d829383bc0c..e25d7aa03d7b4ce78fc1a26fb3bc038c9f6b84ae 100644 --- a/src/includes/components/widgets.pug +++ b/src/includes/components/widgets.pug @@ -81,7 +81,7 @@ sib-widget(name='cs-validate-action') sib-widget(name='cs-detail-action') template div - sib-link( + sib-link.detailLink( data-src="\${src}" next="\${value}" ) <i class="fas fa-eye"></i> diff --git a/src/includes/head.pug b/src/includes/head.pug index 3f431dc843b07ff34c35a4fc07cd5a097858ec02..907cc5fc4ad7e7f01b96f182cc4888633a610f1e 100644 --- a/src/includes/head.pug +++ b/src/includes/head.pug @@ -2,7 +2,7 @@ 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/core@0.8") 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") diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug index 924f9702d5ecee0f534c19a5542098e91a445624..b9ed142c2bdf143dfe6e8e675d72648e31170f93 100644 --- a/src/includes/mentor/resources/detail.pug +++ b/src/includes/mentor/resources/detail.pug @@ -9,7 +9,7 @@ include ../../components/widgets div#detail-mentor-loader hidden Loading the resource, please wait... - sib-display( + sib-display#detail-mentor( loader-id="detail-mentor-loader" bind-resources, fields='name, steps, format.name,\ diff --git a/src/includes/mentor/resources/resource-report-broken-link.pug b/src/includes/mentor/resources/resource-report-broken-link.pug index d7fe5d958de7a1f2129d695c466eb6f38e772292..b7b2be128ebd3e240103e7095deb863946989c9e 100644 --- a/src/includes/mentor/resources/resource-report-broken-link.pug +++ b/src/includes/mentor/resources/resource-report-broken-link.pug @@ -6,13 +6,11 @@ h2.title_lead_avenir Thanks! p The submitter of the resource will be advised that this link is broken. - sib-form( - bind-resources - fields="name, submitter, broken" - range-broken=`${endpoints.brokenlinks}` - widget-name = "hidden-widget" - widget-submitter = "hidden-widget" - widget-broken = "hidden-widget" + sib-form#report-broken-link( + data-src=`${endpoints.brokenlinks}` + fields = "resource_id, submitter" + widget-resource_id='sib-form-hidden' + widget-submitter='sib-form-hidden' submit-button='ok' next="mentor-resource-list" ) \ No newline at end of file diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index c4819ea4119654d1c5e8ed96ebd437b3944f6818..f7588b69041e55049f8f51291c1e41c1b564ff4d 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -374,15 +374,27 @@ jQuery(document).ready(function($) { //MENTOR DASHBOARD************************************************************* window.setTimeout(() => { + + //Manage the form to report broken link. + let detailsMentor = document.getElementById("detail-mentor"); + detailsMentor.addEventListener("populate", event => { + var formBrokenLink = document.getElementById("report-broken-link"); + + formBrokenLink.querySelector( + "input[name='resource_id']" + ).value = JSON.stringify({ "@id": event.target.dataset.src }); + formBrokenLink.querySelector( + "input[name='submitter']" + ).value = JSON.stringify({ "@id": userAccountDataSrc.dataset.src }); + }); + var forms = document.querySelectorAll("sib-form"); forms.forEach(form => { form.addEventListener("populate", e => { var previewImage = document.querySelectorAll( "sib-form-file input[name='preview_image']+input" ); - var previewlabel = document.querySelectorAll( - "sib-form-file div" - ); + var previewlabel = document.querySelectorAll("sib-form-file div"); for (let item of previewlabel) { item.innerHTML="Upload a file" }