Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
9648043f
Commit
9648043f
authored
Nov 23, 2013
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch answer formatting to Django templates, Add special chars handling
parent
9f9617b4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
10 deletions
+16
-10
mentoring/answer.py
+8
-7
mentoring/mentoring.py
+1
-0
mentoring/quizz.py
+0
-3
static/html/answer_editable.html
+3
-0
static/html/answer_read_only.html
+4
-0
No files found.
mentoring/answer.py
View file @
9648043f
...
@@ -10,7 +10,7 @@ from xblock.fields import Any, Boolean, Scope, String
...
@@ -10,7 +10,7 @@ from xblock.fields import Any, Boolean, Scope, String
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
.models
import
Answer
from
.models
import
Answer
from
.utils
import
load_resource
from
.utils
import
load_resource
,
render_template
# Globals ###########################################################
# Globals ###########################################################
...
@@ -47,14 +47,15 @@ class AnswerBlock(XBlock):
...
@@ -47,14 +47,15 @@ class AnswerBlock(XBlock):
return
Fragment
(
u"<p>I can only appear inside mentoring blocks.</p>"
)
return
Fragment
(
u"<p>I can only appear inside mentoring blocks.</p>"
)
def
mentoring_view
(
self
,
context
=
None
):
def
mentoring_view
(
self
,
context
=
None
):
# TODO: Switch to Django templates & security
# TODO: Keep new lines
if
not
self
.
read_only
:
if
not
self
.
read_only
:
html
=
u'<textarea cols="100" rows="10" maxlength="{}" name="input">{}</textarea>'
.
format
(
html
=
render_template
(
'static/html/answer_editable.html'
,
{
Answer
.
_meta
.
get_field
(
'student_input'
)
.
max_length
,
'self'
:
self
,
self
.
student_input
)
'max_length'
:
Answer
.
_meta
.
get_field
(
'student_input'
)
.
max_length
,
})
else
:
else
:
html
=
u'<blockquote class="answer read_only">{}</blockquote>'
.
format
(
self
.
student_input
)
html
=
render_template
(
'static/html/answer_read_only.html'
,
{
'self'
:
self
,
})
fragment
=
Fragment
(
html
)
fragment
=
Fragment
(
html
)
fragment
.
add_css
(
load_resource
(
'static/css/answer.css'
))
fragment
.
add_css
(
load_resource
(
'static/css/answer.css'
))
...
...
mentoring/mentoring.py
View file @
9648043f
...
@@ -88,6 +88,7 @@ class MentoringBlock(XBlock):
...
@@ -88,6 +88,7 @@ class MentoringBlock(XBlock):
completed
=
completed
and
child_result
[
'completed'
]
completed
=
completed
and
child_result
[
'completed'
]
self
.
completed
=
bool
(
completed
)
self
.
completed
=
bool
(
completed
)
self
.
save
()
return
{
return
{
'submitResults'
:
submit_results
,
'submitResults'
:
submit_results
,
...
...
mentoring/quizz.py
View file @
9648043f
...
@@ -105,9 +105,6 @@ class QuizzBlock(XBlock):
...
@@ -105,9 +105,6 @@ class QuizzBlock(XBlock):
'completed'
:
completed
,
'completed'
:
completed
,
'tip'
:
formatted_tip
,
'tip'
:
formatted_tip
,
}
}
log
.
debug
(
u'display_with_defaults:
%
s, reject_with_defaults:
%
s'
,
self
.
display_with_defaults
,
self
.
reject_with_defaults
)
log
.
debug
(
u'Quizz submission result:
%
s'
,
result
)
log
.
debug
(
u'Quizz submission result:
%
s'
,
result
)
return
result
return
result
...
...
static/html/answer_editable.html
0 → 100644
View file @
9648043f
<textarea
cols=
"100"
rows=
"10"
maxlength=
"{{ max_length }}"
name=
"input"
>
{{ self.student_input }}
</textarea>
static/html/answer_read_only.html
0 → 100644
View file @
9648043f
<blockquote
class=
"answer read_only"
>
{{ self.student_input|linebreaksbr }}
</blockquote>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment