summaryrefslogtreecommitdiffstats
path: root/templates/page.html
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-03-31 15:01:01 -0700
committerSamy Pessé <samypesse@gmail.com>2014-03-31 15:01:02 -0700
commit6261d42b955bfad9dab3ed6c2faebce956c64eb2 (patch)
tree04f8541f0170fc6cec87cba93b287e50ad8b312a /templates/page.html
parent8e22d80c7c4ba34aab39d645a57e2f70b666fdb7 (diff)
downloadgitbook-6261d42b955bfad9dab3ed6c2faebce956c64eb2.zip
gitbook-6261d42b955bfad9dab3ed6c2faebce956c64eb2.tar.gz
gitbook-6261d42b955bfad9dab3ed6c2faebce956c64eb2.tar.bz2
Add base for full display of exercises
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