Skip to content

Commit f8559a0

Browse files
authored
SAK-43455 Make the grading and student rubrics kb accessible (sakaiproject#8086)
https://jira.sakaiproject.org/browse/SAK-43455
1 parent d5e3e83 commit f8559a0

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading-comment.js

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {RubricsElement} from "./rubrics-element.js";
2-
import {html} from "/webcomponents/assets/lit-element/lit-element.js";
3-
import {tr} from "./sakai-rubrics-language.js";
1+
import { RubricsElement } from "./rubrics-element.js";
2+
import { html } from "/webcomponents/assets/lit-element/lit-element.js";
3+
import { tr } from "./sakai-rubrics-language.js";
44

55
export class SakaiRubricGradingComment extends RubricsElement {
66

@@ -16,25 +16,27 @@ export class SakaiRubricGradingComment extends RubricsElement {
1616
return {
1717
criterion: { type: Object },
1818
entityId: { attribute: "entity-id", type: String },
19-
evaluatedItemId: { attribute: "evaluated-item-id", type: String },
19+
evaluatedItemId: { attribute: "evaluated-item-id", type: String }
2020
};
2121
}
2222

2323
set criterion(newValue) {
2424

2525
var oldValue = this._criterion;
2626
this._criterion = newValue;
27-
this._criterion.comments = (newValue.comments && newValue.comments.indexOf("null") === 0) ? "" : newValue.comments;
27+
this._criterion.comments = newValue.comments && newValue.comments.indexOf("null") === 0 ? "" : newValue.comments;
2828
this.requestUpdate("criterion", oldValue);
2929
}
3030

31-
get criterion() { return this._criterion; }
31+
get criterion() {
32+
return this._criterion;
33+
}
3234

3335
render() {
3436

3537
return html`
3638
<!-- edit icon -->
37-
<div style="cursor: pointer;" class="comment-icon fa fa-2x fa-comments ${this.criterion.comments ? "active": ""}" @click="${this.toggleEditor}" title="${tr("criterion_comment")}"></div>
39+
<div tabindex="0" style="cursor: pointer;" class="comment-icon fa fa-2x fa-comments ${this.criterion.comments ? "active" : ""}" @click=${this.toggleEditor} @keypress=${this.toggleEditor} title="${tr("criterion_comment")}"></div>
3840
3941
<!-- popover -->
4042
<div id="criterion-editor-${this.criterion.id}-${this.randombit}" class="popover criterion-edit-popover left">
@@ -76,7 +78,7 @@ export class SakaiRubricGradingComment extends RubricsElement {
7678
var popover = $(`#criterion-editor-${this.criterion.id}-${this.randombit}`);
7779

7880
popover[0].style.left = e.target.offsetLeft - 270 + "px";
79-
popover[0].style.top = ((e.target.offsetTop + e.target.offsetHeight/2 + 20) - popover.height()/2) + "px";
81+
popover[0].style.top = e.target.offsetTop + e.target.offsetHeight / 2 + 20 - popover.height() / 2 + "px";
8082

8183
this.setupEditor();
8284

@@ -99,23 +101,19 @@ export class SakaiRubricGradingComment extends RubricsElement {
99101
if (!this.criterion.comments) {
100102
this.criterion.comments = "";
101103
}
102-
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}));
104+
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 }));
103105
this.requestUpdate();
104106
}
105107

106108
setupEditor() {
107109

108110
try {
109111
var commentEditor = CKEDITOR.replace('criterion_' + this.evaluatedItemId + '_' + this.entityId + '_comment_' + this.criterion.id + '|' + this.randombit + '|', {
110-
toolbar : [
111-
// ['Bold', 'Italic', 'Underline', '-', 'Link', 'Unlink'],
112-
['Bold', 'Italic', 'Underline'],
113-
['NumberedList','BulletedList', 'Blockquote']
114-
],
115-
height: 40,
112+
toolbar: [['Bold', 'Italic', 'Underline'], ['NumberedList', 'BulletedList', 'Blockquote']],
113+
height: 40
116114
});
117115

118-
commentEditor.on('change', (e) => this.criterion.comments = commentEditor.getData() );
116+
commentEditor.on('change', e => this.criterion.comments = commentEditor.getData());
119117
} catch (error) {
120118
console.log(error);
121119
}

rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-grading.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class SakaiRubricGrading extends RubricsElement {
3535
translatedTotalPoints: { type: Number },
3636
selectedRatings: { type: Array },
3737
criteria: { type: Array },
38-
rubric: { type: Object },
38+
rubric: { type: Object }
3939
};
4040
}
4141

@@ -46,7 +46,9 @@ export class SakaiRubricGrading extends RubricsElement {
4646
} else this._token = newValue;
4747
}
4848

49-
get token() { return this._token; }
49+
get token() {
50+
return this._token;
51+
}
5052

5153
attributeChangedCallback(name, oldVal, newVal) {
5254

@@ -72,7 +74,7 @@ export class SakaiRubricGrading extends RubricsElement {
7274
<div class="cr-table">
7375
<div class="cr-table-row">
7476
${c.ratings.map(r => html`
75-
<div class="rating-item ${this.selectedRatings.includes(r.id) ? "selected" : ""}" data-rating-id="${r.id}" id="rating-item-${r.id}" data-criterion-id="${c.id}" @click="${this.toggleRating}">
77+
<div class="rating-item ${this.selectedRatings.includes(r.id) ? "selected" : ""}" tabindex="0" data-rating-id="${r.id}" id="rating-item-${r.id}" data-criterion-id="${c.id}" @keypress=${this.toggleRating} @click=${this.toggleRating}>
7678
<h5 class="criterion-item-title">${r.title}</h5>
7779
<p>${r.description}</p>
7880
<span class="points" data-points="${r.points}">${r.points.toLocaleString(this.locale)} <sr-lang key="points">Points</sr-lang></span>
@@ -202,7 +204,7 @@ export class SakaiRubricGrading extends RubricsElement {
202204
points: c.pointoverride || c.selectedvalue,
203205
comments: c.comments,
204206
pointsAdjusted: c.pointoverride !== c.selectedvalue,
205-
selectedRatingId: c.selectedRatingId,
207+
selectedRatingId: c.selectedRatingId
206208
};
207209
});
208210

@@ -212,7 +214,7 @@ export class SakaiRubricGrading extends RubricsElement {
212214
evaluatedItemOwnerId: window.top.portal.siteId,
213215
overallComment: "",
214216
criterionOutcomes: crit,
215-
toolItemRubricAssociation: this.association._links.self.href,
217+
toolItemRubricAssociation: this.association._links.self.href
216218
};
217219

218220
if (this.evaluation && this.evaluation.id) {
@@ -227,9 +229,9 @@ export class SakaiRubricGrading extends RubricsElement {
227229
headers: {
228230
"Authorization": this.token,
229231
"Accept": "application/json",
230-
"Content-Type": "application/json",
232+
"Content-Type": "application/json"
231233
},
232-
method: this.evaluation && this.evaluation.id ? "PATCH" : "POST",
234+
method: this.evaluation && this.evaluation.id ? "PATCH" : "POST"
233235
}).then(r => r.json()).then(r => this.evaluation = r);
234236
}
235237

rubrics/tool/src/main/frontend/webcomponents/js/sakai-rubric-student-comment.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {RubricsElement} from "./rubrics-element.js";
2-
import {html} from "/webcomponents/assets/lit-element/lit-element.js";
3-
import {unsafeHTML} from "/webcomponents/assets/lit-html/directives/unsafe-html.js";
4-
import {tr} from "./sakai-rubrics-language.js";
1+
import { RubricsElement } from "./rubrics-element.js";
2+
import { html } from "/webcomponents/assets/lit-element/lit-element.js";
3+
import { unsafeHTML } from "/webcomponents/assets/lit-html/directives/unsafe-html.js";
4+
import { tr } from "./sakai-rubrics-language.js";
55

66
export class SakaiRubricStudentComment extends RubricsElement {
77

@@ -20,16 +20,18 @@ export class SakaiRubricStudentComment extends RubricsElement {
2020

2121
var oldValue = this._criterion;
2222
this._criterion = newValue;
23-
this._criterion.comments = (newValue.comments && newValue.comments.indexOf("null") === 0) ? "" : newValue.comments;
23+
this._criterion.comments = newValue.comments && newValue.comments.indexOf("null") === 0 ? "" : newValue.comments;
2424
this.requestUpdate("criterion", oldValue);
2525
}
2626

27-
get criterion() { return this._criterion; }
27+
get criterion() {
28+
return this._criterion;
29+
}
2830

2931
render() {
3032

3133
return html`
32-
<div style="${this.criterion.comments ? "cursor: pointer;" : ""}" class="comment-icon fa fa-2x fa-comments ${this.criterion.comments ? "active": ""}" @click="${this.toggleComment}" title="${tr("criterion_comment_student")}"></div>
34+
<div tabindex="0" style="${this.criterion.comments ? "cursor: pointer;" : ""}" class="comment-icon fa fa-2x fa-comments ${this.criterion.comments ? "active" : ""}" @click=${this.toggleComment} @keypress=${this.toggleComment} title="${tr("criterion_comment_student")}"></div>
3335
3436
<!-- popover -->
3537
<div id="criterion-comment-viewer-${this.criterion.id}-${this.randombit}" class="popover criterion-edit-popover left">
@@ -66,7 +68,7 @@ export class SakaiRubricStudentComment extends RubricsElement {
6668

6769
this.classList.add('show-tooltip');
6870
popover[0].style.left = e.target.offsetLeft - 270 + "px";
69-
popover[0].style.top = (e.target.offsetTop + e.target.offsetHeight/2 - popover.height()/2) + "px";
71+
popover[0].style.top = e.target.offsetTop + e.target.offsetHeight / 2 - popover.height() / 2 + "px";
7072
popover.show();
7173
} else {
7274
this.classList.remove('show-tooltip');

0 commit comments

Comments
 (0)