From 54188fe54284b81d3cfda17ee2e03fa03b708011 Mon Sep 17 00:00:00 2001 From: Adrian Fish Date: Tue, 16 May 2023 13:56:07 +0100 Subject: [PATCH] SAK-48451 fix criterion edit popover (#11556) * SAK-48451 fix criterion edit popover https://sakaiproject.atlassian.net/browse/SAK-48451 * Update webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric.js * Update webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric.js * Update webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric.js * Update webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric-criterion-edit.js * Update webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric.js --- .../sass/modules/tool/rubrics/_rubrics.scss | 1 + .../js/rubrics/sakai-rubric-criteria.js | 2 + .../js/rubrics/sakai-rubric-criterion-edit.js | 172 +++++++----------- .../frontend/js/rubrics/sakai-rubric-edit.js | 3 +- 4 files changed, 74 insertions(+), 104 deletions(-) diff --git a/library/src/skins/default/src/sass/modules/tool/rubrics/_rubrics.scss b/library/src/skins/default/src/sass/modules/tool/rubrics/_rubrics.scss index 436a849d29b7..ba55d8a1e89e 100644 --- a/library/src/skins/default/src/sass/modules/tool/rubrics/_rubrics.scss +++ b/library/src/skins/default/src/sass/modules/tool/rubrics/_rubrics.scss @@ -559,6 +559,7 @@ sakai-rubric-student-comment { [class*="edit-popover"] { width: 400px; + --bs-popover-max-width: 800px; .popover-content { word-break: break-word; diff --git a/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric-criteria.js b/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric-criteria.js index f623b3e066fb..5b472ec650c5 100644 --- a/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric-criteria.js +++ b/webcomponents/tool/src/main/frontend/js/rubrics/sakai-rubric-criteria.js @@ -76,6 +76,7 @@ export class SakaiRubricCriteria extends RubricsElement { ${c.title} ${c.title} this.querySelector(`#edit-criterion-${this.criterion.id}`).innerHTML, + customClass: "criterion-edit-popover", + html: true, + placement: "bottom", + sanitize: false, + }); + + this.querySelector("button").addEventListener("shown.bs.popover", () => { + + const save = document.querySelector(".popover.show .btn-primary"); + save.addEventListener("click", this.saveEdit); + save.closest(".popover-body").querySelector("input").focus(); + + document.querySelector(".popover.show .btn-secondary") + .addEventListener("click", this.cancelEdit); + }); + } + render() { return html` - - -
-
-
-
- - -
-
-
-
-