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
d02539cb
Commit
d02539cb
authored
Sep 17, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Persist step info.
parent
9cf2ee45
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
3 deletions
+36
-3
problem_builder/mentoring.py
+16
-0
problem_builder/public/js/mentoring_with_steps.js
+17
-2
problem_builder/step.py
+3
-1
No files found.
problem_builder/mentoring.py
View file @
d02539cb
...
...
@@ -834,6 +834,14 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
scope
=
Scope
.
settings
)
# User state
step
=
Integer
(
# Keep track of the student progress.
default
=
0
,
scope
=
Scope
.
user_state
,
enforce_type
=
True
)
editable_fields
=
(
'display_name'
,)
@lazy
...
...
@@ -900,6 +908,14 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
NestedXBlockSpec
(
OnAssessmentReviewMentoringMessageShim
,
boilerplate
=
'on-assessment-review'
),
]
@XBlock.json_handler
def
update_step
(
self
,
step
,
suffix
=
''
):
if
step
<
len
(
self
.
steps
):
self
.
step
=
step
return
{
'step'
:
self
.
step
}
def
author_edit_view
(
self
,
context
):
"""
Add some HTML to the author view that allows authors to add child blocks.
...
...
problem_builder/public/js/mentoring_with_steps.js
View file @
d02539cb
...
...
@@ -3,14 +3,27 @@ function MentoringWithStepsBlock(runtime, element) {
var
steps
=
runtime
.
children
(
element
).
filter
(
function
(
c
)
{
return
c
.
element
.
className
.
indexOf
(
'pb-mentoring-step'
)
>
-
1
;
}
);
var
active_child
=
-
1
;
var
checkmark
,
submitDOM
,
nextDOM
;
var
step
=
$
(
'.mentoring'
,
element
).
data
(
'step'
)
;
var
active_child
,
checkmark
,
submitDOM
,
nextDOM
;
function
isLastChild
()
{
return
(
active_child
===
steps
.
length
-
1
);
}
function
updateStep
()
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'update_step'
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
step
+
1
))
.
success
(
function
(
response
)
{
step
=
response
.
step
;
console
.
log
(
'Step: '
+
step
);
});
}
function
handleResults
(
response
)
{
// Update step so next step is shown on page reload (even if user does not click "Next Step")
updateStep
();
// Update UI
if
(
response
.
completed
===
'correct'
)
{
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
}
else
if
(
response
.
completed
===
'partial'
)
{
...
...
@@ -106,6 +119,8 @@ function MentoringWithStepsBlock(runtime, element) {
};
initSteps
(
options
);
active_child
=
step
;
active_child
-=
1
;
displayNextChild
();
}
...
...
problem_builder/step.py
View file @
d02539cb
...
...
@@ -75,13 +75,15 @@ class MentoringStepBlock(
STUDIO_LABEL
=
_
(
u"Mentoring Step"
)
CATEGORY
=
'pb-mentoring-step'
#
Fields:
#
Settings
display_name
=
String
(
display_name
=
_
(
"Step Title"
),
help
=
_
(
'Leave blank to use sequential numbering'
),
default
=
""
,
scope
=
Scope
.
content
)
# User state
student_results
=
List
(
# Store results of student choices.
default
=
[],
...
...
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