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
f07502fe
Commit
f07502fe
authored
Sep 22, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect to review step when reloading page after submitting last step.
parent
433ce153
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
problem_builder/mentoring.py
+8
-0
problem_builder/public/js/mentoring_with_steps.js
+21
-5
No files found.
problem_builder/mentoring.py
View file @
f07502fe
...
@@ -865,6 +865,11 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
...
@@ -865,6 +865,11 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
child_isinstance
(
self
,
child_id
,
MentoringStepBlock
)
child_isinstance
(
self
,
child_id
,
MentoringStepBlock
)
]
]
@property
def
has_review_step
(
self
):
from
.step
import
ReviewStepBlock
return
any
(
child_isinstance
(
self
,
child_id
,
ReviewStepBlock
)
for
child_id
in
self
.
children
)
def
student_view
(
self
,
context
):
def
student_view
(
self
,
context
):
fragment
=
Fragment
()
fragment
=
Fragment
()
children_contents
=
[]
children_contents
=
[]
...
@@ -919,6 +924,9 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
...
@@ -919,6 +924,9 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
def
update_active_step
(
self
,
new_value
,
suffix
=
''
):
def
update_active_step
(
self
,
new_value
,
suffix
=
''
):
if
new_value
<
len
(
self
.
steps
):
if
new_value
<
len
(
self
.
steps
):
self
.
active_step
=
new_value
self
.
active_step
=
new_value
elif
new_value
==
len
(
self
.
steps
):
if
self
.
has_review_step
:
self
.
active_step
=
-
1
return
{
return
{
'active_step'
:
self
.
active_step
'active_step'
:
self
.
active_step
}
}
...
...
problem_builder/public/js/mentoring_with_steps.js
View file @
f07502fe
...
@@ -10,6 +10,10 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -10,6 +10,10 @@ function MentoringWithStepsBlock(runtime, element) {
return
(
activeStep
===
steps
.
length
-
1
);
return
(
activeStep
===
steps
.
length
-
1
);
}
}
function
atReviewStep
()
{
return
(
activeStep
===
-
1
);
}
function
updateActiveStep
(
newValue
)
{
function
updateActiveStep
(
newValue
)
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'update_active_step'
);
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'update_active_step'
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
newValue
))
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
newValue
))
...
@@ -64,14 +68,26 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -64,14 +68,26 @@ function MentoringWithStepsBlock(runtime, element) {
function
updateDisplay
()
{
function
updateDisplay
()
{
cleanAll
();
cleanAll
();
showActiveStep
();
if
(
atReviewStep
())
{
validateXBlock
();
showReviewStep
();
nextDOM
.
attr
(
'disabled'
,
'disabled'
);
}
else
{
if
(
isLastStep
())
{
showActiveStep
();
reviewDOM
.
show
();
validateXBlock
();
nextDOM
.
attr
(
'disabled'
,
'disabled'
);
if
(
isLastStep
())
{
reviewDOM
.
show
();
}
}
}
}
}
function
showReviewStep
()
{
reviewStep
.
show
();
submitDOM
.
hide
();
nextDOM
.
hide
();
tryAgainDOM
.
removeAttr
(
'disabled'
);
tryAgainDOM
.
show
();
}
function
showActiveStep
()
{
function
showActiveStep
()
{
var
step
=
steps
[
activeStep
];
var
step
=
steps
[
activeStep
];
$
(
step
.
element
).
show
();
$
(
step
.
element
).
show
();
...
...
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