From 427a6f820c77bf01a089ce385606e83dbbd8a2c2 Mon Sep 17 00:00:00 2001 From: antoine37120 <ant.dupre@gmail.com> Date: Mon, 18 Sep 2023 17:51:59 +0200 Subject: [PATCH] fix: uniq index reload and filter for folow and auto eval --- src/views-terrytories.js | 4 +-- src/widjets-display-evaluation-tzcld.js | 23 ++++++++-------- src/widjets-display-follow-tzcld.js | 36 ++++++++++++++++--------- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/views-terrytories.js b/src/views-terrytories.js index 20c3804..66af34f 100644 --- a/src/views-terrytories.js +++ b/src/views-terrytories.js @@ -419,7 +419,7 @@ import("./utils.js").then((utils) => { </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}-answer"> + <div class="loader" id="loader-${this.route}-auto-answer"> <div></div> <div></div> <div></div> @@ -429,7 +429,7 @@ import("./utils.js").then((utils) => { <tzcld-autoeval class="tzcld-autoeval" bind-resources="" - loader-id="loader-${this.route}-answer" + loader-id="loader-${this.route}-auto-answer" parts ="${this.parts}" parts-points ="${this.partsPoints}" point-answers ="${this.pointAnswers}" diff --git a/src/widjets-display-evaluation-tzcld.js b/src/widjets-display-evaluation-tzcld.js index 87d7850..9d0eaaf 100644 --- a/src/widjets-display-evaluation-tzcld.js +++ b/src/widjets-display-evaluation-tzcld.js @@ -163,16 +163,15 @@ core.Sib.register({ if (await point.fieldType == "checkboxe") { let widget_id = 'autoeval-answer-form' ; render += ` <div class="full"> - <solid-form-search id="filter-anwer-${utils.getIntId(point['@id'])}" class="hidden" + <solid-form-search id="filter-anwer-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" class="hidden" fields="community, evaluation_point" value-community="${communityId}" value-evaluation_point="${point['@id']}" ></solid-form-search> <solid-display solid-resource - bind-resources fields="@id" - filtered-by="filter-anwer-${utils.getIntId(point['@id'])}" + filtered-by="filter-anwer-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" data-src="${pointsAnswers}" widget-id="${widget_id}" ></solid-display> @@ -180,16 +179,15 @@ core.Sib.register({ } else { let widget_id = 'autoeval-answer-form-option-custom' ; render += ` <div class="full"> - <solid-form-search id="filter-anwer-${utils.getIntId(point['@id'])}" class="hidden" + <solid-form-search id="filter-anwer-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" class="hidden" fields="community, evaluation_point" value-community="${communityId}" value-evaluation_point="${point['@id']}" ></solid-form-search> <solid-display solid-resource - bind-resources fields="evaluation_point_answer" - filtered-by="filter-anwer-${utils.getIntId(point['@id'])}" + filtered-by="filter-anwer-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" data-src="${point['@id']}" widget-evaluation_point_answer="${widget_id}" ></solid-display> @@ -247,7 +245,6 @@ core.Sib.register({ <div class="segment auto padding-small text-top whitespace-normal"> <solid-display data-src="${await tzcldprofile.answer['@id']}" solid-resource - bind-resources fields="evaluation_point.name" widget-evaluation_point.name="span" ></solid-display> @@ -314,7 +311,7 @@ core.Sib.register({ <div class="segment full auto-eval-answer"> <div class="segment half padding-small"> <div class="segment auto padding-small text-top"> - <solid-form solid-resource bind-resources fields="answer" data-src="\${value}" + <solid-form solid-resource fields="answer" data-src="\${value}" widget-answer="solid-form-checkbox" label-answer=" " class-submit-button="hidden" @@ -324,7 +321,6 @@ core.Sib.register({ <div class="segment auto padding-small text-top whitespace-normal"> <solid-display data-src="\${value}" solid-resource - bind-resources fields="evaluation_point.name" widget-evaluation_point.name="span" ></solid-display> @@ -332,7 +328,7 @@ core.Sib.register({ </div> <div class="segment half padding-small text-top"> <solid-form - solid-resource bind-resources fields="comment" class="form" data-src="\${value}" + solid-resource fields="comment" class="form" data-src="\${value}" widget-comment="solid-form-textarea-label" label-comment=" " class-comment="segment margin-bottom-medium full sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" @@ -345,7 +341,12 @@ core.Sib.register({ </solid-widget> <!--<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="title, subtitle, part_points" class="segment full" + <solid-display + solid-resource + data-src="${this.element.getAttribute('parts')}" + parts-points="${this.element.getAttribute('parts-points')}" + fields="title, subtitle, part_points" + class="segment full" multiple-part_points="tzcld-autoeval-points" widget-name="div" widget-title="h2" diff --git a/src/widjets-display-follow-tzcld.js b/src/widjets-display-follow-tzcld.js index 954e9ef..21a92e8 100644 --- a/src/widjets-display-follow-tzcld.js +++ b/src/widjets-display-follow-tzcld.js @@ -120,16 +120,18 @@ core.Sib.register({ let widget_id = 'follow-answer-form' ; render += ` <div class="full"> - <solid-form-search id="filter-anwer-${utils.getIntId(point['@id'])}" class="hidden" + <solid-form-search + id="filter-follow-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" + class="hidden" fields="community, followed_point" value-community="${communityId}" value-followed_point="${point['@id']}" + naked ></solid-form-search> <solid-display - solid-resource - bind-resources + solid-resource fields="@id" - filtered-by="filter-anwer-${utils.getIntId(point['@id'])}" + filtered-by="filter-follow-${utils.getIntId(point['@id'])}-${utils.getIntId(communityId)}" data-src="${pointsAnswers}" widget-id="${widget_id}" ></solid-display> @@ -176,15 +178,19 @@ core.Sib.register({ <div class="segment full auto-eval-answer"> <div class="segment half padding-small whitespace-normal"> <div class="segment full padding-small text-top whitespace-normal"> - <solid-display data-src="\${value}" + <solid-display + data-src="\${value}" solid-resource - bind-resources fields="followed_point.name" widget-followed_point.name="h4" ></solid-display> </div> <div class="segment full padding-small text-top"> - <solid-form solid-resource bind-resources fields="answer" class="form" data-src="\${value}" + <solid-form + solid-resource + fields="answer" + class="form" + data-src="\${value}" widget-answer="solid-form-textarea-label" label-answer=" " class-answer="segment margin-bottom-medium full sm-full padding-right-small sm-padding-none text-small text-semibold text-color-heading whitespace-normal text-xlarge" @@ -206,12 +212,16 @@ core.Sib.register({ </solid-widget> <!--<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="title, followed_part_points" class="segment full" - multiple-followed_part_points="tzcld-follow-points" - widget-name="div" - widget-title="h2" - class-title="margin-large margin-left-small text-xlarge text-xbold text-color-heading" - class-followed_part_points="full" + <solid-display + solid-resource + data-src="${this.element.getAttribute('parts')}" + parts-points="${this.element.getAttribute('parts-points')}" + fields="title, followed_part_points" class="segment full" + multiple-followed_part_points="tzcld-follow-points" + widget-name="div" + widget-title="h2" + class-title="margin-large margin-left-small text-xlarge text-xbold text-color-heading" + class-followed_part_points="full" ></solid-display>`; -- GitLab