Skip to content
Snippets Groups Projects
Commit 1e05637b authored by Antoine Dupré's avatar Antoine Dupré
Browse files

feature: add display for points parts

parent 801b764c
No related branches found
No related tags found
No related merge requests found
Pipeline #14919 passed
......@@ -76,6 +76,88 @@ import("./utils.js").then((utils) => {
}
}
);
core.Sib.register({
name: "tzcld-autoeval-points",
use: [core.StoreMixin],
empty() {
console.debug();
this.element.innerHTML = "";
},
async populate() {
this.element.innerHTML = `
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
</div>`;
let tzcldprofile = {
community: await this.resource,
name: await this.resource.name,
};
console.log(this.element.getAttribute('parts') );
console.log(await tzcldprofile.community) ;
if("label" in this.element.attributes) {
for(let ignore of this.element.attributes['label'].value.split(',')) {
tzcldprofile[ignore.trim()] = null;
}
}
let render = `
<solid-display solid-resource bind-resources fields="name reponse" data-src="${this.element.getAttribute('data-src')}" widget-name="div"
></solid-display>`;
this.element.innerHTML = render;
}
});
core.Sib.register({
name: "tzcld-autoeval",
use: [core.StoreMixin],
empty() {
console.debug();
this.element.innerHTML = "";
},
async populate() {
this.element.innerHTML = `
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
</div>`;
let tzcldprofile = {
community: await this.resource,
name: await this.resource.name,
};
console.log(this.element.getAttribute('parts') );
console.log(await tzcldprofile.community) ;
if("label" in this.element.attributes) {
for(let ignore of this.element.attributes['label'].value.split(',')) {
tzcldprofile[ignore.trim()] = null;
}
}
let render = `<div>${await tzcldprofile.name}</div>
<solid-display solid-resource bind-resources data-src="${this.element.getAttribute('parts')}" parts-points="${this.element.getAttribute('parts-points')}" fields="name, title, subtitle, part_points"
multiple-part_points="tzcld-autoeval-points",
widget-name="div",
widget-title="div",
widget-subtitle="div",
widget-part_points="tzcld-autoeval-points",
></solid-display>`;
this.element.innerHTML = render;
}
});
customElements.define(
"solid-tzcld",
class extends core.SolidTemplateElement {
......@@ -97,8 +179,9 @@ import("./utils.js").then((utils) => {
routeurs() {
let render = `
<solid-router default-route="${this.route}-answers">
<solid-route name="${this.route}-answers"></solid-route>
<solid-router default-route="${this.route}-my-communities">
<solid-route name="${this.route}-answers" use-id></solid-route>
<solid-route name="${this.route}-my-communities"></solid-route>
</solid-router>
`;
......@@ -110,6 +193,44 @@ import("./utils.js").then((utils) => {
return render;
}
viewMyCommunities() {
let render = `
<div id="${this.route}-my-communities" data-view="${this.route}-my-communities" class="tzcld-my-communities">
<div class="segment full padding-large border-bottom border-color-grey" style="padding-top: 0;">
<div class="segment full sm-hidden text-right">
<solid-link class="backlink" next="${this.route}-community-profile">${this.localize("back")}</solid-link>
</div>
</div>
<div class="segment block shadow bg-color-white margin-right-xxsmall margin-left-xxsmall sm-margin-none">
<div class="loader" id="loader-${this.route}-my-communities">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<solid-display
bind-resources=""
loader-id="loader-${this.route}-my-communities"
data-src ="${this.communities}"
fields="name"
next="${this.route}-answers"
`;
render += `>
</solid-display>`;
render += `
</div>
</div>`;
return render;
}
viewCommunityAnswers() {
......@@ -130,15 +251,17 @@ import("./utils.js").then((utils) => {
<div></div>
</div>
<solid-display
<tzcld-autoeval
bind-resources=""
loader-id="loader-${this.route}-answer"
data-src ="${this.parts}"
parts ="${this.parts}"
parts-points ="${this.partsPoints}"
point-answers ="${this.pointAnswers}"
solid-resource
`;
render += `>
</solid-display>`;
</tzcld-autoeval>`;
render += `
......@@ -162,6 +285,7 @@ import("./utils.js").then((utils) => {
${this.routeurs()}
${this.viewWidgets()}
${this.viewCommunityAnswers()}
${this.viewMyCommunities()}
`;
return render;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment