diff --git a/BUGS.md b/BUGS.md index 17182e6..0816177 100644 --- a/BUGS.md +++ b/BUGS.md @@ -8,13 +8,13 @@ BUGS: TODO: - configuração e linha de comando. -- logging - como gerar uma sequencia de perguntas? - generators not working: bcrypt (ver blog) -- implementar navegacao radio/checkbox. cursor cima/baixo, espaco selecciona, enter submete. SOLVED: +- implementar navegacao radio/checkbox. cursor cima/baixo, espaco selecciona, enter submete. +- logging - textarea tem codigo para preencher o texto, mas ja não é necessário porque pergunta não é reloaded. - gravar answers -> db - como gerar key para secure cookie. diff --git a/README.md b/README.md index 7d1d673..a733b3b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Requirements -We will need to install python3.6, pip and sqlite3 python package. +We will need to install python3.6 with sqlite3 support. This can be done using the system package management, downloaded from [http://www.python.org](), or compiled from sources. - Installing from the system package management: @@ -18,12 +18,12 @@ This can be done using the system package management, downloaded from [http://ww - `./configure --prefix=$HOME/.local/bin` - `make && make install` -To install pip (if not yet installed): +Next install pip (if not yet installed): python36 -m ensurepip --user This will install pip in your account under `~/.local/bin`. -In the end you should be able to run `pip3 --version` and `python3 -c "import sqlite3"` without errors (sometimes `pip3` is `pip`, `pip3.6` or `pip-3.6` are used). +In the end you should be able to run `pip3 --version` and `python3 -c "import sqlite3"` without errors (sometimes `pip3` is `pip`, `pip3.6` or `pip-3.6`). Install additional python packages locally on the user area: @@ -39,7 +39,6 @@ Note: If you want to always install python modules on the user account, edit the [global] user = yes - ## Installation Replace USER by your bitbucket username: @@ -60,7 +59,6 @@ First we need to create a database: We also need certificates for https. Generate selfsigned certificates using openssl: - mkdir certs cd certs openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes cd .. diff --git a/templates/learn.html b/templates/learn.html index c2665e6..0b0ff44 100644 --- a/templates/learn.html +++ b/templates/learn.html @@ -98,20 +98,14 @@ $.fn.extend({ } }); +// Processes the response given by the served after an answer is submitted. function updateQuestion(response){ - switch (response["method"]) { case "new_question": $("#question_div").html(response["params"]); MathJax.Hub.Queue(["Typeset",MathJax.Hub,"question_div"]); - $("input:text").keypress(function (e) { - if (e.keyCode == 13) { - e.preventDefault(); - getQuestion(); - } - }); - $("textarea").keydown(function (e) { + $("textarea, input:text, input:radio, input:checkbox").keydown(function (e) { if (e.keyCode == 13 && e.shiftKey) { e.preventDefault(); getQuestion(); @@ -129,6 +123,8 @@ function updateQuestion(response){ } } +// Send answer and receive a response. +// The response can be a new_question or a shake if the answer is wrong. function getQuestion() { $.ajax({ type: "POST", @@ -144,7 +140,6 @@ function getQuestion() { $(document).ready(function() { var audio = new Audio('/static/sounds/intro.mp3'); audio.play(); - // getQuestion(); $("#submit").click(getQuestion); }); diff --git a/templates/question-checkbox.html b/templates/question-checkbox.html index f652818..b405553 100644 --- a/templates/question-checkbox.html +++ b/templates/question-checkbox.html @@ -6,7 +6,7 @@