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
a06370c0
Commit
a06370c0
authored
Sep 23, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show appropriate assessment message when reaching review step.
parent
431bc480
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletions
+46
-1
problem_builder/mentoring.py
+29
-0
problem_builder/public/js/mentoring_with_steps.js
+11
-1
problem_builder/templates/html/mentoring_with_steps.html
+6
-0
No files found.
problem_builder/mentoring.py
View file @
a06370c0
...
@@ -870,6 +870,35 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
...
@@ -870,6 +870,35 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
from
.step
import
ReviewStepBlock
from
.step
import
ReviewStepBlock
return
any
(
child_isinstance
(
self
,
child_id
,
ReviewStepBlock
)
for
child_id
in
self
.
children
)
return
any
(
child_isinstance
(
self
,
child_id
,
ReviewStepBlock
)
for
child_id
in
self
.
children
)
@property
def
max_attempts_reached
(
self
):
return
False
@property
def
assessment_message
(
self
):
"""
Get the message to display to a student following a submission in assessment mode.
"""
if
not
self
.
max_attempts_reached
:
return
self
.
get_message_content
(
'on-assessment-review'
,
or_default
=
True
)
else
:
assessment_message
=
_
(
"Note: you have used all attempts. Continue to the next unit"
)
return
'<p>{}</p>'
.
format
(
assessment_message
)
def
get_message_content
(
self
,
message_type
,
or_default
=
False
):
for
child_id
in
self
.
children
:
if
child_isinstance
(
self
,
child_id
,
MentoringMessageBlock
):
child
=
self
.
runtime
.
get_block
(
child_id
)
if
child
.
type
==
message_type
:
content
=
child
.
content
if
hasattr
(
self
.
runtime
,
'replace_jump_to_id_urls'
):
content
=
self
.
runtime
.
replace_jump_to_id_urls
(
content
)
return
content
if
or_default
:
# Return the default value since no custom message is set.
# Note the WYSIWYG editor usually wraps the .content HTML in a <p> tag so we do the same here.
return
'<p>{}</p>'
.
format
(
MentoringMessageBlock
.
MESSAGE_TYPES
[
message_type
][
'default'
])
def
student_view
(
self
,
context
):
def
student_view
(
self
,
context
):
fragment
=
Fragment
()
fragment
=
Fragment
()
children_contents
=
[]
children_contents
=
[]
...
...
problem_builder/public/js/mentoring_with_steps.js
View file @
a06370c0
...
@@ -4,7 +4,7 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -4,7 +4,7 @@ function MentoringWithStepsBlock(runtime, element) {
function
(
c
)
{
return
c
.
element
.
className
.
indexOf
(
'sb-step'
)
>
-
1
;
}
function
(
c
)
{
return
c
.
element
.
className
.
indexOf
(
'sb-step'
)
>
-
1
;
}
);
);
var
activeStep
=
$
(
'.mentoring'
,
element
).
data
(
'active-step'
);
var
activeStep
=
$
(
'.mentoring'
,
element
).
data
(
'active-step'
);
var
reviewStep
,
checkmark
,
submitDOM
,
nextDOM
,
reviewDOM
,
tryAgainDOM
,
submitXHR
;
var
reviewStep
,
checkmark
,
submitDOM
,
nextDOM
,
reviewDOM
,
tryAgainDOM
,
assessmentMessageDOM
,
submitXHR
;
function
isLastStep
()
{
function
isLastStep
()
{
return
(
activeStep
===
steps
.
length
-
1
);
return
(
activeStep
===
steps
.
length
-
1
);
...
@@ -71,11 +71,13 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -71,11 +71,13 @@ function MentoringWithStepsBlock(runtime, element) {
checkmark
.
removeClass
(
'checkmark-partially-correct icon-ok fa-check'
);
checkmark
.
removeClass
(
'checkmark-partially-correct icon-ok fa-check'
);
checkmark
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
checkmark
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
hideAllSteps
();
hideAllSteps
();
assessmentMessageDOM
.
html
(
''
);
}
}
function
updateDisplay
()
{
function
updateDisplay
()
{
cleanAll
();
cleanAll
();
if
(
atReviewStep
())
{
if
(
atReviewStep
())
{
showAssessmentMessage
();
showReviewStep
();
showReviewStep
();
}
else
{
}
else
{
showActiveStep
();
showActiveStep
();
...
@@ -87,6 +89,11 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -87,6 +89,11 @@ function MentoringWithStepsBlock(runtime, element) {
}
}
}
}
function
showAssessmentMessage
()
{
var
data
=
$
(
'.grade'
,
element
).
data
();
assessmentMessageDOM
.
html
(
data
.
assessment_message
);
}
function
showReviewStep
()
{
function
showReviewStep
()
{
reviewStep
.
show
();
reviewStep
.
show
();
submitDOM
.
hide
();
submitDOM
.
hide
();
...
@@ -135,6 +142,7 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -135,6 +142,7 @@ function MentoringWithStepsBlock(runtime, element) {
function
showGrade
()
{
function
showGrade
()
{
cleanAll
();
cleanAll
();
showAssessmentMessage
();
showReviewStep
();
showReviewStep
();
}
}
...
@@ -178,6 +186,8 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -178,6 +186,8 @@ function MentoringWithStepsBlock(runtime, element) {
tryAgainDOM
=
$
(
element
).
find
(
'.submit .input-try-again'
);
tryAgainDOM
=
$
(
element
).
find
(
'.submit .input-try-again'
);
tryAgainDOM
.
on
(
'click'
,
tryAgain
);
tryAgainDOM
.
on
(
'click'
,
tryAgain
);
assessmentMessageDOM
=
$
(
'.assessment-message'
,
element
);
var
options
=
{
var
options
=
{
onChange
:
onChange
onChange
:
onChange
};
};
...
...
problem_builder/templates/html/mentoring_with_steps.html
View file @
a06370c0
...
@@ -9,10 +9,16 @@
...
@@ -9,10 +9,16 @@
<div
class=
"assessment-question-block"
>
<div
class=
"assessment-question-block"
>
<div
class=
"assessment-message"
></div>
{% for child_content in children_contents %}
{% for child_content in children_contents %}
{{ child_content|safe }}
{{ child_content|safe }}
{% endfor %}
{% endfor %}
<div
class=
"grade"
data-assessment_message=
"{{ self.assessment_message }}"
</
div
>
<div
class=
"submit"
>
<div
class=
"submit"
>
<span
class=
"assessment-checkmark fa icon-2x"
></span>
<span
class=
"assessment-checkmark fa icon-2x"
></span>
<input
type=
"button"
class=
"input-main"
value=
"Submit"
disabled=
"disabled"
/>
<input
type=
"button"
class=
"input-main"
value=
"Submit"
disabled=
"disabled"
/>
...
...
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