forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-40310 Adding rubric preview back in for students (sakaiproject#6669)
- Loading branch information
1 parent
6622c8d
commit f489673
Showing
12 changed files
with
131 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,3 @@ | |
.btn-table { | ||
height: 34px; | ||
} | ||
.gb-summary-grade-score-rubric { | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
rubrics/tool/src/main/frontend/webcomponents/sakai-rubric-student-preview-button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import {SakaiElement} from "/webcomponents/sakai-element.js"; | ||
import {html} from "/webcomponents/assets/lit-element/lit-element.js"; | ||
import {SakaiRubricsLanguage, tr} from "./sakai-rubrics-language.js"; | ||
import {SakaiRubricsHelpers} from "./sakai-rubrics-helpers.js"; | ||
|
||
export class SakaiRubricStudentPreviewButton extends SakaiElement { | ||
|
||
constructor() { | ||
|
||
super(); | ||
|
||
this.display = "button"; | ||
|
||
SakaiRubricsLanguage.loadTranslations().then(result => this.i18nLoaded = result ); | ||
} | ||
|
||
static get properties() { | ||
|
||
return { | ||
token: { type: String }, | ||
display: { type: String }, | ||
toolId: { attribute: "tool-id", type: String }, | ||
entityId: { attribute: "entity-id", type: String }, | ||
rubricId: { type: String }, | ||
}; | ||
} | ||
|
||
set token(newValue) { | ||
|
||
this._token = "Bearer " + newValue; | ||
rubrics.initLightbox(this._token); | ||
} | ||
|
||
get token() { return this._token; } | ||
|
||
attributeChangedCallback(name, oldValue, newValue) { | ||
|
||
super.attributeChangedCallback(name, oldValue, newValue); | ||
|
||
if (this.token && this.toolId && this.entityId) { | ||
this.getRubricId(); | ||
} | ||
} | ||
|
||
shouldUpdate(changedProperties) { | ||
return changedProperties.has("rubricId"); | ||
} | ||
|
||
render() { | ||
|
||
return html` | ||
${this.display === "button" ? | ||
html`<h3><sr-lang key="grading_rubric" /></h3> | ||
<button onclick="rubrics.previewRubric('${this.rubricId}'); return false;"><sr-lang key="preview_rubric" /></button>` | ||
: html`<span class="fa fa-table" style="cursor: pointer;" title="${tr("preview_rubric")}" onclick="rubrics.previewRubric('${this.rubricId}')" />` | ||
} | ||
`; | ||
} | ||
|
||
getRubricId() { | ||
|
||
SakaiRubricsHelpers.get("/rubrics-service/rest/rubric-associations/search/by-tool-item-ids", this.token, { params: {toolId: this.toolId, itemId: this.entityId }}) | ||
.then(data => { | ||
|
||
const association = data._embedded["rubric-associations"][0]; | ||
if (!association.parameters.hideStudentPreview) { | ||
this.rubricId = association.rubricId}; | ||
}); | ||
} | ||
} | ||
|
||
customElements.define("sakai-rubric-student-preview-button", SakaiRubricStudentPreviewButton); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters