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
d9423680
Commit
d9423680
authored
Apr 10, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from aboudreault/mrq-hide-results
Mrq hide results
parents
a2e3724d
3b6ade2a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
7 deletions
+45
-7
README.md
+19
-2
mentoring/light_children.py
+10
-1
mentoring/mrq.py
+2
-1
mentoring/public/js/answer.js
+6
-0
mentoring/public/js/questionnaire.js
+7
-2
mentoring/templates/html/mrqblock_choices.html
+1
-1
No files found.
README.md
View file @
d9423680
...
...
@@ -78,7 +78,7 @@ Second XBlock instance:
### Self-assessment MRQs
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
max_attempts=
"3
"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
hide_results=
"true
"
>
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
<choice
value=
"beauty"
>
Its beauty
</choice>
...
...
@@ -122,6 +122,23 @@ Second XBlock instance:
</vertical>
```
### Maximum Attempts
You can set the number of maximum attempts for the unit completion:
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
max_attempts=
"3"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
hide_results=
"true"
>
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
...
</mrq>
<message
type=
"completed"
>
All is good now...
<html><p>
Congratulations!
</p></html>
</message>
</mentoring>
```
### Custom feedback popup window
You can use the
`feedback`
child to have a custom popup window. Currently, only the
*width*
and
...
...
@@ -129,7 +146,7 @@ You can use the `feedback` child to have a custom popup window. Currently, only
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
max_attempts=
"3"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
>
<question>
What do you like in this MRQ?
</question>
<choice
value=
"elegance"
>
Its elegance
</choice>
...
...
...
mentoring/light_children.py
View file @
d9423680
...
...
@@ -331,6 +331,7 @@ class LightChildField(object):
def
__set__
(
self
,
instance
,
value
):
self
.
data
[
instance
]
=
value
class
String
(
LightChildField
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
String
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -353,7 +354,15 @@ class Integer(LightChildField):
class
Boolean
(
LightChildField
):
pass
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
Boolean
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
default
=
kwargs
.
get
(
'default'
,
False
)
def
__set__
(
self
,
instance
,
value
):
if
isinstance
(
value
,
basestring
):
value
=
value
.
lower
()
==
'true'
self
.
data
[
instance
]
=
value
class
List
(
LightChildField
):
...
...
mentoring/mrq.py
View file @
d9423680
...
...
@@ -26,7 +26,7 @@
import
logging
from
.light_children
import
List
,
Scope
from
.light_children
import
List
,
Scope
,
Boolean
from
.questionnaire
import
QuestionnaireAbstractBlock
from
.utils
import
render_template
...
...
@@ -43,6 +43,7 @@ class MRQBlock(QuestionnaireAbstractBlock):
An XBlock used to ask multiple-response questions
"""
student_choices
=
List
(
help
=
"Last submissions by the student"
,
default
=
[],
scope
=
Scope
.
user_state
)
hide_results
=
Boolean
(
help
=
"Hide results"
,
scope
=
Scope
.
content
,
default
=
False
)
def
submit
(
self
,
submissions
):
log
.
debug
(
u'Received MRQ submissions: "
%
s"'
,
submissions
)
...
...
mentoring/public/js/answer.js
View file @
d9423680
...
...
@@ -27,6 +27,12 @@ function AnswerBlock(runtime, element) {
// Returns `true` if the child is valid, else `false`
validate
:
function
()
{
// return true if the answer is read only
var
blockquote_ro
=
$
(
'blockquote.answer.read_only'
,
element
);
if
(
blockquote_ro
.
length
>
0
)
return
true
;
var
input
=
$
(
':input'
,
element
),
input_value
=
input
.
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
),
answer_length
=
input_value
.
length
,
...
...
mentoring/public/js/questionnaire.js
View file @
d9423680
...
...
@@ -112,6 +112,10 @@ function MRQBlock(runtime, element) {
result
.
message
+
'</div>'
);
}
var
questionnaireDOM
=
$
(
'fieldset.questionnaire'
,
element
),
data
=
questionnaireDOM
.
data
(),
hide_results
=
(
data
.
hide_results
===
'True'
)
?
true
:
false
;
$
.
each
(
result
.
choices
,
function
(
index
,
choice
)
{
var
choiceInputDOM
=
$
(
'.choice input[value='
+
choice
.
value
+
']'
,
element
),
choiceDOM
=
choiceInputDOM
.
closest
(
'.choice'
),
...
...
@@ -120,11 +124,12 @@ function MRQBlock(runtime, element) {
choiceTipsCloseDOM
;
choiceResultDOM
.
removeClass
(
'checkmark-incorrect icon-exclamation checkmark-correct icon-ok fa-check'
'checkmark-incorrect icon-exclamation
fa-exclamation
checkmark-correct icon-ok fa-check'
);
/* show hint if checked or max_attempts is disabled */
if
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
)
{
if
(
!
hide_results
&&
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
))
{
if
(
choice
.
completed
)
{
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
}
else
if
(
!
choice
.
completed
)
{
...
...
mentoring/templates/html/mrqblock_choices.html
View file @
d9423680
<h2
class=
"problem-header"
>
Multiple Response
</h2>
<fieldset
class=
"choices questionnaire"
>
<fieldset
class=
"choices questionnaire"
data-hide_results=
"{{self.hide_results}}"
>
<legend
class=
"question"
>
{{ self.question }}
</legend>
<div
class=
"choices-list"
>
{% for choice in custom_choices %}
...
...
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