From f8559a02b8c0cfd33c1b50877852c98001f48bbc Mon Sep 17 00:00:00 2001 From: Adrian Fish Date: Thu, 26 Mar 2020 18:08:23 +0000 Subject: [PATCH] SAK-43455 Make the grading and student rubrics kb accessible (#8086) https://jira.sakaiproject.org/browse/SAK-43455 --- .../js/sakai-rubric-grading-comment.js | 30 +++++++++---------- .../webcomponents/js/sakai-rubric-grading.js | 16 +++++----- .../js/sakai-rubric-student-comment.js | 18 ++++++----- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading-comment.js b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading-comment.js index d96e4a85d2fc..709580558680 100644 --- a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading-comment.js +++ b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading-comment.js @@ -1,6 +1,6 @@ -import {RubricsElement} from "./rubrics-element.js"; -import {html} from "/webcomponents/assets/lit-element/lit-element.js"; -import {tr} from "./sakai-rubrics-language.js"; +import { RubricsElement } from "./rubrics-element.js"; +import { html } from "/webcomponents/assets/lit-element/lit-element.js"; +import { tr } from "./sakai-rubrics-language.js"; export class SakaiRubricGradingComment extends RubricsElement { @@ -16,7 +16,7 @@ export class SakaiRubricGradingComment extends RubricsElement { return { criterion: { type: Object }, entityId: { attribute: "entity-id", type: String }, - evaluatedItemId: { attribute: "evaluated-item-id", type: String }, + evaluatedItemId: { attribute: "evaluated-item-id", type: String } }; } @@ -24,17 +24,19 @@ export class SakaiRubricGradingComment extends RubricsElement { var oldValue = this._criterion; this._criterion = newValue; - this._criterion.comments = (newValue.comments && newValue.comments.indexOf("null") === 0) ? "" : newValue.comments; + this._criterion.comments = newValue.comments && newValue.comments.indexOf("null") === 0 ? "" : newValue.comments; this.requestUpdate("criterion", oldValue); } - get criterion() { return this._criterion; } + get criterion() { + return this._criterion; + } render() { return html` -
+
@@ -76,7 +78,7 @@ export class SakaiRubricGradingComment extends RubricsElement { var popover = $(`#criterion-editor-${this.criterion.id}-${this.randombit}`); popover[0].style.left = e.target.offsetLeft - 270 + "px"; - popover[0].style.top = ((e.target.offsetTop + e.target.offsetHeight/2 + 20) - popover.height()/2) + "px"; + popover[0].style.top = e.target.offsetTop + e.target.offsetHeight / 2 + 20 - popover.height() / 2 + "px"; this.setupEditor(); @@ -99,7 +101,7 @@ export class SakaiRubricGradingComment extends RubricsElement { if (!this.criterion.comments) { this.criterion.comments = ""; } - this.dispatchEvent(new CustomEvent('update-comment', {detail: {evaluatedItemId: this.evaluatedItemId, entityId: this.entityId, criterionId: this.criterion.id, value: this.criterion.comments}, bubbles: true, composed: true})); + this.dispatchEvent(new CustomEvent('update-comment', { detail: { evaluatedItemId: this.evaluatedItemId, entityId: this.entityId, criterionId: this.criterion.id, value: this.criterion.comments }, bubbles: true, composed: true })); this.requestUpdate(); } @@ -107,15 +109,11 @@ export class SakaiRubricGradingComment extends RubricsElement { try { var commentEditor = CKEDITOR.replace('criterion_' + this.evaluatedItemId + '_' + this.entityId + '_comment_' + this.criterion.id + '|' + this.randombit + '|', { - toolbar : [ - // ['Bold', 'Italic', 'Underline', '-', 'Link', 'Unlink'], - ['Bold', 'Italic', 'Underline'], - ['NumberedList','BulletedList', 'Blockquote'] - ], - height: 40, + toolbar: [['Bold', 'Italic', 'Underline'], ['NumberedList', 'BulletedList', 'Blockquote']], + height: 40 }); - commentEditor.on('change', (e) => this.criterion.comments = commentEditor.getData() ); + commentEditor.on('change', e => this.criterion.comments = commentEditor.getData()); } catch (error) { console.log(error); } diff --git a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading.js b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading.js index b817ab77ccc7..b22b5bab55ed 100644 --- a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading.js +++ b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading.js @@ -35,7 +35,7 @@ export class SakaiRubricGrading extends RubricsElement { translatedTotalPoints: { type: Number }, selectedRatings: { type: Array }, criteria: { type: Array }, - rubric: { type: Object }, + rubric: { type: Object } }; } @@ -46,7 +46,9 @@ export class SakaiRubricGrading extends RubricsElement { } else this._token = newValue; } - get token() { return this._token; } + get token() { + return this._token; + } attributeChangedCallback(name, oldVal, newVal) { @@ -72,7 +74,7 @@ export class SakaiRubricGrading extends RubricsElement {
${c.ratings.map(r => html` -
+
${r.title}

${r.description}

${r.points.toLocaleString(this.locale)} Points @@ -202,7 +204,7 @@ export class SakaiRubricGrading extends RubricsElement { points: c.pointoverride || c.selectedvalue, comments: c.comments, pointsAdjusted: c.pointoverride !== c.selectedvalue, - selectedRatingId: c.selectedRatingId, + selectedRatingId: c.selectedRatingId }; }); @@ -212,7 +214,7 @@ export class SakaiRubricGrading extends RubricsElement { evaluatedItemOwnerId: window.top.portal.siteId, overallComment: "", criterionOutcomes: crit, - toolItemRubricAssociation: this.association._links.self.href, + toolItemRubricAssociation: this.association._links.self.href }; if (this.evaluation && this.evaluation.id) { @@ -227,9 +229,9 @@ export class SakaiRubricGrading extends RubricsElement { headers: { "Authorization": this.token, "Accept": "application/json", - "Content-Type": "application/json", + "Content-Type": "application/json" }, - method: this.evaluation && this.evaluation.id ? "PATCH" : "POST", + method: this.evaluation && this.evaluation.id ? "PATCH" : "POST" }).then(r => r.json()).then(r => this.evaluation = r); } diff --git a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-student-comment.js b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-student-comment.js index 09256f288b67..bc8697bf7176 100644 --- a/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-student-comment.js +++ b/rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-student-comment.js @@ -1,7 +1,7 @@ -import {RubricsElement} from "./rubrics-element.js"; -import {html} from "/webcomponents/assets/lit-element/lit-element.js"; -import {unsafeHTML} from "/webcomponents/assets/lit-html/directives/unsafe-html.js"; -import {tr} from "./sakai-rubrics-language.js"; +import { RubricsElement } from "./rubrics-element.js"; +import { html } from "/webcomponents/assets/lit-element/lit-element.js"; +import { unsafeHTML } from "/webcomponents/assets/lit-html/directives/unsafe-html.js"; +import { tr } from "./sakai-rubrics-language.js"; export class SakaiRubricStudentComment extends RubricsElement { @@ -20,16 +20,18 @@ export class SakaiRubricStudentComment extends RubricsElement { var oldValue = this._criterion; this._criterion = newValue; - this._criterion.comments = (newValue.comments && newValue.comments.indexOf("null") === 0) ? "" : newValue.comments; + this._criterion.comments = newValue.comments && newValue.comments.indexOf("null") === 0 ? "" : newValue.comments; this.requestUpdate("criterion", oldValue); } - get criterion() { return this._criterion; } + get criterion() { + return this._criterion; + } render() { return html` -
+
@@ -66,7 +68,7 @@ export class SakaiRubricStudentComment extends RubricsElement { this.classList.add('show-tooltip'); popover[0].style.left = e.target.offsetLeft - 270 + "px"; - popover[0].style.top = (e.target.offsetTop + e.target.offsetHeight/2 - popover.height()/2) + "px"; + popover[0].style.top = e.target.offsetTop + e.target.offsetHeight / 2 - popover.height() / 2 + "px"; popover.show(); } else { this.classList.remove('show-tooltip');