summaryrefslogtreecommitdiffstats
path: root/templates/page.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/page.html')
-rw-r--r--templates/page.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/templates/page.html b/templates/page.html
index 3c2eb89..d7a23ac 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -22,4 +22,30 @@
</div>
</div>
</div>
+
+<script>
+$(document).ready(function() {
+ $("section.exercise").each(function() {
+ var $exercise = $(this);
+
+ var codeSolution = $exercise.find(".code-solution").html();
+ var codeValidation = $exercise.find(".code-validation").html();
+
+ var editor = ace.edit($exercise.find(".editor").get(0));
+ editor.setTheme("ace/theme/tomorrow");
+ editor.getSession().setMode("ace/mode/javascript");
+
+ $exercise.find(".action-submit").click(function(e) {
+ e.preventDefault();
+
+ alert("submit");
+ });
+ $exercise.find(".action-solution").click(function(e) {
+ e.preventDefault();
+
+ editor.setValue(codeSolution);
+ });
+ })
+});
+</script>
{% endblock %} \ No newline at end of file