Skip to content

Commit

Permalink
reset button for ac
Browse files Browse the repository at this point in the history
  • Loading branch information
sujith-rek committed May 15, 2023
1 parent b7efcc8 commit b90d351
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
18 changes: 18 additions & 0 deletions runestone/activecode/js/activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class ActiveCode extends RunestoneBase {
this.runButton = null;
this.enabledownload = $(orig).data("enabledownload");
this.downloadButton = null;
this.resetButton = null;
this.saveButton = null;
this.loadButton = null;
this.outerDiv = null;
Expand Down Expand Up @@ -278,6 +279,8 @@ export class ActiveCode extends RunestoneBase {
this.runButton.onclick = this.runButtonHandler.bind(this);
$(butt).attr("type", "button");

this.addResetButton(ctrlDiv);

if (this.enabledownload || eBookConfig.downloadsEnabled) {
this.addDownloadButton(ctrlDiv);
}
Expand Down Expand Up @@ -354,6 +357,16 @@ export class ActiveCode extends RunestoneBase {
$(butt).attr("type", "button");
}

addResetButton(ctrlDiv) {
let butt = document.createElement("button");
$(butt).text("Reset");
$(butt).addClass("btn btn-default");
$(butt).attr("type", "button");
ctrlDiv.appendChild(butt);
this.resetButton = butt;
$(butt).click(this.resetCode.bind(this));
}

enableHideShow(ctrlDiv) {
$(this.runButton).attr("disabled", "disabled");
let butt = document.createElement("button");
Expand Down Expand Up @@ -763,6 +776,11 @@ export class ActiveCode extends RunestoneBase {
}
}

resetCode() {
localStorage.removeItem(this.divid);
window.location.reload();
}

async createGradeSummary() {
// get grade and comments for this assignment
// get summary of all grades for this student
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit b90d351

Please sign in to comment.