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
c6e60602
Commit
c6e60602
authored
Oct 15, 2015
by
Kelketek
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74 from open-craft/custom_next_text
Make 'next' button text customizable in Mentoring Steps.
parents
5c07c47f
43436a95
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
2 deletions
+66
-2
problem_builder/public/js/mentoring_with_steps.js
+8
-0
problem_builder/public/js/step.js
+4
-0
problem_builder/step.py
+7
-1
problem_builder/templates/html/step.html
+1
-1
problem_builder/tests/integration/test_step_builder.py
+15
-0
problem_builder/tests/integration/xml_templates/step_builder_next.xml
+31
-0
No files found.
problem_builder/public/js/mentoring_with_steps.js
View file @
c6e60602
...
@@ -175,8 +175,14 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -175,8 +175,14 @@ function MentoringWithStepsBlock(runtime, element) {
reviewTipsDOM
.
empty
().
hide
();
reviewTipsDOM
.
empty
().
hide
();
}
}
function
updateNextLabel
()
{
var
step
=
steps
[
activeStep
];
nextDOM
.
attr
(
'value'
,
step
.
getStepLabel
());
}
function
updateDisplay
()
{
function
updateDisplay
()
{
cleanAll
();
cleanAll
();
if
(
atReviewStep
())
{
if
(
atReviewStep
())
{
// Tell supporting runtimes to enable navigation between units;
// Tell supporting runtimes to enable navigation between units;
// user is currently not in the middle of an attempt
// user is currently not in the middle of an attempt
...
@@ -188,6 +194,7 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -188,6 +194,7 @@ function MentoringWithStepsBlock(runtime, element) {
}
else
{
}
else
{
showActiveStep
();
showActiveStep
();
validateXBlock
();
validateXBlock
();
updateNextLabel
();
nextDOM
.
attr
(
'disabled'
,
'disabled'
);
nextDOM
.
attr
(
'disabled'
,
'disabled'
);
if
(
isLastStep
()
&&
reviewStep
)
{
if
(
isLastStep
()
&&
reviewStep
)
{
reviewDOM
.
attr
(
'disabled'
,
'disabled'
);
reviewDOM
.
attr
(
'disabled'
,
'disabled'
);
...
@@ -243,6 +250,7 @@ function MentoringWithStepsBlock(runtime, element) {
...
@@ -243,6 +250,7 @@ function MentoringWithStepsBlock(runtime, element) {
activeStep
=
stepIndex
;
activeStep
=
stepIndex
;
cleanAll
();
cleanAll
();
showActiveStep
();
showActiveStep
();
updateNextLabel
();
if
(
isLastStep
())
{
if
(
isLastStep
())
{
reviewDOM
.
show
();
reviewDOM
.
show
();
...
...
problem_builder/public/js/step.js
View file @
c6e60602
...
@@ -81,6 +81,10 @@ function MentoringStepBlock(runtime, element) {
...
@@ -81,6 +81,10 @@ function MentoringStepBlock(runtime, element) {
callIfExists
(
child
,
'handleReview'
,
result
);
callIfExists
(
child
,
'handleReview'
,
result
);
}
}
}
}
},
getStepLabel
:
function
()
{
return
$
(
'.sb-step'
,
element
).
data
(
'next-button-label'
);
}
}
};
};
...
...
problem_builder/step.py
View file @
c6e60602
...
@@ -99,7 +99,13 @@ class MentoringStepBlock(
...
@@ -99,7 +99,13 @@ class MentoringStepBlock(
scope
=
Scope
.
user_state
scope
=
Scope
.
user_state
)
)
editable_fields
=
(
'display_name'
,
'show_title'
,)
next_button_label
=
String
(
display_name
=
_
(
"Next Button Label"
),
help
=
_
(
"Customize the text of the 'Next' button."
),
default
=
_
(
"Next Step"
)
)
editable_fields
=
(
'display_name'
,
'show_title'
,
'next_button_label'
)
@lazy
@lazy
def
siblings
(
self
):
def
siblings
(
self
):
...
...
problem_builder/templates/html/step.html
View file @
c6e60602
<div
class=
"sb-step"
>
<div
class=
"sb-step"
data-next-button-label=
"{{ self.next_button_label }}"
>
{% if show_title %}
{% if show_title %}
<div
class=
"title"
>
<div
class=
"title"
>
<h3>
<h3>
...
...
problem_builder/tests/integration/test_step_builder.py
View file @
c6e60602
...
@@ -215,6 +215,21 @@ class StepBuilderTest(MentoringAssessmentBaseTest):
...
@@ -215,6 +215,21 @@ class StepBuilderTest(MentoringAssessmentBaseTest):
None
,
step_builder
,
controls
,
extended_feedback
=
True
,
alternative_review
=
True
None
,
step_builder
,
controls
,
extended_feedback
=
True
,
alternative_review
=
True
)
)
def
test_next_label
(
self
):
step_builder
,
controls
=
self
.
load_assessment_scenario
(
"step_builder_next.xml"
)
self
.
expect_question_visible
(
None
,
step_builder
)
self
.
assertEqual
(
controls
.
next_question
.
get_attribute
(
'value'
),
"Next Challenge"
)
self
.
freeform_answer
(
None
,
step_builder
,
controls
,
'This is the answer'
,
CORRECT
)
self
.
expect_question_visible
(
None
,
step_builder
)
self
.
assertEqual
(
controls
.
next_question
.
get_attribute
(
'value'
),
"Next Item"
)
self
.
single_choice_question
(
None
,
step_builder
,
controls
,
'Maybe not'
,
INCORRECT
)
self
.
rating_question
(
None
,
step_builder
,
controls
,
"5 - Extremely good"
,
CORRECT
,
last
=
True
)
# Check extended feedback loads the labels correctly.
step_builder
.
find_elements_by_css_selector
(
'.correct-list li a'
)[
0
]
.
click
()
self
.
expect_question_visible
(
None
,
step_builder
)
self
.
assertEqual
(
controls
.
next_question
.
get_attribute
(
'value'
),
"Next Challenge"
)
@data
(
@data
(
{
"max_attempts"
:
0
,
"extended_feedback"
:
False
},
# Unlimited attempts, no extended feedback
{
"max_attempts"
:
0
,
"extended_feedback"
:
False
},
# Unlimited attempts, no extended feedback
{
"max_attempts"
:
1
,
"extended_feedback"
:
True
},
# Limited attempts, extended feedback
{
"max_attempts"
:
1
,
"extended_feedback"
:
True
},
# Limited attempts, extended feedback
...
...
problem_builder/tests/integration/xml_templates/step_builder_next.xml
0 → 100644
View file @
c6e60602
<step-builder
url_name=
"step-builder"
display_name=
"Step Builder"
max_attempts=
"1"
extended_feedback=
"True"
>
<sb-step
display_name=
"First step"
next_button_label=
"Next Challenge"
>
<pb-answer
name=
"goal"
question=
"What is your goal?"
/>
</sb-step>
<sb-step
display_name=
"Second step"
next_button_label=
"Next Item"
>
<pb-mcq
name=
"mcq_1_1"
question=
"Do you like this MCQ?"
correct_choices=
'["yes"]'
>
<pb-choice
value=
"yes"
>
Yes
</pb-choice>
<pb-choice
value=
"maybenot"
>
Maybe not
</pb-choice>
<pb-choice
value=
"understand"
>
I don't understand
</pb-choice>
<pb-tip
values=
'["yes"]'
>
Great!
</pb-tip>
<pb-tip
values=
'["maybenot"]'
>
Ah, damn.
</pb-tip>
<pb-tip
values=
'["understand"]'
><div
id=
"test-custom-html"
>
Really?
</div></pb-tip>
</pb-mcq>
</sb-step>
<sb-step
display_name=
"Third step"
>
<pb-rating
name=
"mcq_1_2"
low=
"Not good at all"
high=
"Extremely good"
question=
"How much do you rate this MCQ?"
correct_choices=
'["4","5"]'
>
<pb-choice
value=
"notwant"
>
I don't want to rate it
</pb-choice>
<pb-tip
values=
'["4","5"]'
>
I love good grades.
</pb-tip>
<pb-tip
values=
'["1","2", "3"]'
>
Will do better next time...
</pb-tip>
<pb-tip
values=
'["notwant"]'
>
Your loss!
</pb-tip>
</pb-rating>
</sb-step>
<sb-review-step
/>
</step-builder>
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