diff --git a/e2xgrader/server_extensions/formgrader/static/js/formgrade.js b/e2xgrader/server_extensions/formgrader/static/js/formgrade.js index b156a085..7421b0b4 100644 --- a/e2xgrader/server_extensions/formgrader/static/js/formgrade.js +++ b/e2xgrader/server_extensions/formgrader/static/js/formgrade.js @@ -10,6 +10,7 @@ FormGrader.prototype.init = function () { this.loadGrades(); this.loadComments(); this.loadAnnotations(); + this.collapsibleCells(); // disable link selection on tabs $('a:not(.tabbable)').attr('tabindex', '-1'); @@ -68,6 +69,28 @@ FormGrader.prototype.init = function () { this.loaded = true; }; +FormGrader.prototype.collapsibleCells = function () { + console.log('hello'); + $('.collapsible').each(function(idx, elem) { + let button = $(elem); + console.log(button); + let body = button.parent().parent().find('.panel-body'); + + button.click(function () { + $(body).toggle(); + if ($(body).is(":hidden")) { + button.text("Show Test Code"); + } else { + button.text("Hide Test Code"); + + } + + }); + + console.log(body); + }); +}; + FormGrader.prototype.loadGrades = function () { var that = this; diff --git a/e2xgrader/server_extensions/formgrader/templates/formgrade/index.html.j2 b/e2xgrader/server_extensions/formgrader/templates/formgrade/index.html.j2 index 6d57d333..56db1dd6 100644 --- a/e2xgrader/server_extensions/formgrader/templates/formgrade/index.html.j2 +++ b/e2xgrader/server_extensions/formgrader/templates/formgrade/index.html.j2 @@ -320,6 +320,7 @@ div.prompt { {%- elif cell.metadata.nbgrader.grade -%} {{ cell.metadata.nbgrader.grade_id }} {{ score(cell) }} + {%- endif -%} {%- endmacro %} @@ -437,4 +438,4 @@ div.prompt { {%- endif -%} -{% endblock input %} +{% endblock input %} \ No newline at end of file