Commit 7c0e56cadd2e4a8960a462d98e7d6b1648780ba1

Authored by Miguel Barao
1 parent a96cd2c7
Exists in master and in 1 other branch dev

- allow textarea and text to have initial text defined in the question.

1 BUGS: 1 BUGS:
2 2
3 - se students.db não existe, rebenta. 3 - se students.db não existe, rebenta.
4 -- textarea tem codigo para preencher o texto, mas ja não é necessário porque pergunta não é reloaded.  
5 - questions hardcoded in LearnApp. 4 - questions hardcoded in LearnApp.
6 - database hardcoded in LearnApp. 5 - database hardcoded in LearnApp.
7 - implementar xsrf. Ver [http://www.tornadoweb.org/en/stable/guide/security.html#cross-site-request-forgery-protection]() 6 - implementar xsrf. Ver [http://www.tornadoweb.org/en/stable/guide/security.html#cross-site-request-forgery-protection]()
@@ -16,6 +15,7 @@ TODO: @@ -16,6 +15,7 @@ TODO:
16 15
17 SOLVED: 16 SOLVED:
18 17
  18 +- textarea tem codigo para preencher o texto, mas ja não é necessário porque pergunta não é reloaded.
19 - gravar answers -> db 19 - gravar answers -> db
20 - como gerar key para secure cookie. 20 - como gerar key para secure cookie.
21 - https. certificados selfsigned, no-ip nao suporta certificados 21 - https. certificados selfsigned, no-ip nao suporta certificados
templates/question-text.html
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 {% block answer %} 3 {% block answer %}
4 <fieldset data-role="controlgroup"> 4 <fieldset data-role="controlgroup">
5 - <input type="text" class="form-control" id="answer" name="answer" value="" autofocus> 5 + <input type="text" class="form-control" id="answer" name="answer" value="{{ question['answer'] or '' }}" autofocus>
6 </fieldset><br /> 6 </fieldset><br />
7 <input type="hidden" name="question_ref" value="{{ question['ref'] }}"> 7 <input type="hidden" name="question_ref" value="{{ question['ref'] }}">
8 {% end %} 8 {% end %}
templates/question-textarea.html
1 {% extends "question.html" %} 1 {% extends "question.html" %}
2 2
3 {% block answer %} 3 {% block answer %}
4 -<textarea class="form-control" rows="{{ question['lines'] }}" name="answer" autofocus>{{ question['answer'][0] if question['answer'] is not None else '' }}</textarea><br /> 4 +<textarea class="form-control" rows="{{ question['lines'] }}" name="answer" autofocus>{{ question['answer'] or '' }}</textarea><br />
5 <input type="hidden" name="question_ref" value="{{ question['ref'] }}"> 5 <input type="hidden" name="question_ref" value="{{ question['ref'] }}">
6 {% end %} 6 {% end %}