Skip to content

Commit

Permalink
SAK-42752 Moved resubmit block to below grading components (sakaiproj…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianfish authored and Miguel Pellicer committed Nov 13, 2019
1 parent d28b9f8 commit 3ef1a54
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
3 changes: 3 additions & 0 deletions library/src/morpheus-master/sass/modules/grader/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ sakai-grader {
margin-left: 5px;
}

.resubmission-checkbox {
margin-top: 12px;
}
.resubmission-block {

border: black solid 1px;
Expand Down
2 changes: 2 additions & 0 deletions webcomponents/bundle/src/main/bundle/grader.properties
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ lettergrade_selector_label=Letter grade selector
passfail_selector_label=Pass/Fail grade selector
number_grade_label=Numeric grade input field
checkgrade_label=Checkmark grade input box
comment_present=There is a comment on this submission
notes_present=There are private notes on this submission
54 changes: 33 additions & 21 deletions webcomponents/tool/src/main/frontend/grader/sakai-grader.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,6 @@ class SakaiGrader extends gradableDataMixin(SakaiElement) {
return html`
${this.submission.id !== "dummy" ? html`
<div class="grader ${this.graderOnLeft ? "on-left" : ""}">
${this.submission.submittedTime ? html`
<div>
<label>
<input type="checkbox" .checked=${this.showResubmission} @change=${(e) => this.showResubmission = e.target.checked}/>
<span>${this.i18n["allow_resubmission"]}</span>
</label>
</div>
${this.showResubmission ? html`
<div class="resubmission-block">
<span>${this.i18n["number_resubmissions_allowed"]}:</span>
<select aria-label="${this.i18n["attempt_selector_label"]}" @change=${(e) => this.resubmitNumber = e.target.value}>
<option value="1">1</option>
<option value="2">2</option>
</select>
<span>${this.i18n["accept_until"]}:</span>
<sakai-date-picker @datetime-selected=${(e) => this.resubmitDate = e.detail.epochMillis} initial-value="${this.resubmitDate}"></sakai-date-picker>
</div>
` : ""}
` : ""}
<div class="submitted-block">
<div class="submitted-time">
${this.submission.submittedTime ? html`
Expand Down Expand Up @@ -264,7 +245,8 @@ class SakaiGrader extends gradableDataMixin(SakaiElement) {
</div>
<div class="feedback-label grader-label content-button-block">
<button id="grader-feedback-button" @click=${this.toggleFeedback} aria-haspopup="true" title="${this.i18n["add_feedback_tooltip"]}" >${this.i18n["add_feedback"]}</button>
${this.submission.feedbackComment ? html`<div class="active-indicator"></div>` : ""}
${this.submission.feedbackComment ? html`
<div class="active-indicator" aria-label="${this.i18n["comment_present"]}" title="${this.i18n["comment_present"]}"></div>` : ""}
</div>
<div id="feedback-panel" class="grader-panel" title="${this.i18n["feedback"]}" style="display: none;">
<div class="feedback-title">${this.i18n["instructor_comment_title"]}</div>
Expand Down Expand Up @@ -293,7 +275,7 @@ class SakaiGrader extends gradableDataMixin(SakaiElement) {
</div>
<div class="grader-label content-button-block">
<button id="grader-private-notes-button" @click=${this.togglePrivateNotes} aria-haspopup="true" title="${this.i18n["private_notes_tooltip"]}" >${this.i18n["private_notes"]}</button>
${this.submission.privateNotes ? html`<div class="active-indicator"></div>` : ""}
${this.submission.privateNotes ? html`<div class="active-indicator" aria-label="${this.i18n["notes_present"]}" title="${this.i18n["notes_present"]}"></div>` : ""}
</div>
<div id="private-notes-panel" class="grader-panel" title="${this.i18n["private_notes"]}" style="display: none;">
<div class="sak-banner-info">${unsafeHTML(this.i18n["private_notes_tooltip"])}</div>
Expand All @@ -302,6 +284,26 @@ class SakaiGrader extends gradableDataMixin(SakaiElement) {
</div>
<div class="text-feedback">
</div>
${this.submission.submittedTime ? html`
<div class="resubmission-checkbox">
<label>
<input type="checkbox" .checked=${this.showResubmission} @change=${this.toggleResubmissionBlock}/>
<span>${this.i18n["allow_resubmission"]}</span>
</label>
</div>
${this.showResubmission ? html`
<div class="resubmission-block">
<span>${this.i18n["number_resubmissions_allowed"]}:</span>
<select aria-label="${this.i18n["attempt_selector_label"]}" @change=${(e) => this.resubmitNumber = e.target.value}>
<option value="0" .selected=${this.submission.allowResubmitNumber === "1"}>0</option>
<option value="1" .selected=${this.submission.allowResubmitNumber === "1"}>1</option>
<option value="2" .selected=${this.submission.allowResubmitNumber === "2"}>2</option>
</select>
<span>${this.i18n["accept_until"]}:</span>
<sakai-date-picker @datetime-selected=${(e) => this.resubmitDate = e.detail.epochMillis} initial-value="${this.resubmitDate}"></sakai-date-picker>
</div>
` : ""}
` : ""}
<div class="action-button-block act">
<button accesskey="s" class="btn btn-primary active" name="save" @click=${this.save}>${this.i18n["save"]}</button>
<button accesskey="d" name="return" @click=${this.saveAndRelease}>${this.i18n["save_and_release"]}</button>
Expand Down Expand Up @@ -787,6 +789,16 @@ class SakaiGrader extends gradableDataMixin(SakaiElement) {
this.querySelector(`#settings-link`).focus();
}
}

toggleResubmissionBlock(e) {

if (!e.target.checked) {
this.submission.allowResubmitNumber = "0";
} else {
this.submission.allowResubmitNumber = "1";
}
this.showResubmission = e.target.checked;
}
}

customElements.define("sakai-grader", SakaiGrader);
2 changes: 2 additions & 0 deletions webcomponents/tool/src/main/frontend/grader/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export class Submission {
this.feedbackText = this.submittedText || "";
}
this.feedbackComment = init.feedbackComment || "";

this.allowResubmitNumber = this.properties["allow_resubmit_number"];
} else {
this.id = "dummy";
}
Expand Down

0 comments on commit 3ef1a54

Please sign in to comment.