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
c251a614
Commit
c251a614
authored
Sep 23, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show info about number of attempts used if limited number of attempts available.
parent
177e01e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletions
+20
-1
problem_builder/mentoring.py
+2
-0
problem_builder/public/js/mentoring_with_steps.js
+13
-1
problem_builder/templates/html/mentoring_with_steps.html
+5
-0
No files found.
problem_builder/mentoring.py
View file @
c251a614
...
...
@@ -937,6 +937,8 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/problem-builder.css'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/mentoring_with_steps.js'
))
fragment
.
add_resource
(
loader
.
load_unicode
(
'templates/html/mentoring_attempts.html'
),
"text/html"
)
self
.
include_theme_files
(
fragment
)
fragment
.
initialize_js
(
'MentoringWithStepsBlock'
)
...
...
problem_builder/public/js/mentoring_with_steps.js
View file @
c251a614
...
...
@@ -4,7 +4,8 @@ function MentoringWithStepsBlock(runtime, element) {
function
(
c
)
{
return
c
.
element
.
className
.
indexOf
(
'sb-step'
)
>
-
1
;
}
);
var
activeStep
=
$
(
'.mentoring'
,
element
).
data
(
'active-step'
);
var
reviewStep
,
checkmark
,
submitDOM
,
nextDOM
,
reviewDOM
,
tryAgainDOM
,
assessmentMessageDOM
,
submitXHR
;
var
attemptsTemplate
=
_
.
template
(
$
(
'#xblock-attempts-template'
).
html
());
var
reviewStep
,
checkmark
,
submitDOM
,
nextDOM
,
reviewDOM
,
tryAgainDOM
,
assessmentMessageDOM
,
attemptsDOM
,
submitXHR
;
function
isLastStep
()
{
return
(
activeStep
===
steps
.
length
-
1
);
...
...
@@ -80,6 +81,7 @@ function MentoringWithStepsBlock(runtime, element) {
checkmark
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
hideAllSteps
();
assessmentMessageDOM
.
html
(
''
);
attemptsDOM
.
html
(
''
);
}
function
updateDisplay
()
{
...
...
@@ -87,6 +89,7 @@ function MentoringWithStepsBlock(runtime, element) {
if
(
atReviewStep
())
{
showAssessmentMessage
();
showReviewStep
();
showAttempts
();
}
else
{
showActiveStep
();
validateXBlock
();
...
...
@@ -111,6 +114,13 @@ function MentoringWithStepsBlock(runtime, element) {
tryAgainDOM
.
show
();
}
function
showAttempts
()
{
var
data
=
attemptsDOM
.
data
();
if
(
data
.
max_attempts
>
0
)
{
attemptsDOM
.
html
(
attemptsTemplate
(
data
));
}
// Don't show attempts if unlimited attempts available (max_attempts === 0)
}
function
showActiveStep
()
{
var
step
=
steps
[
activeStep
];
$
(
step
.
element
).
show
();
...
...
@@ -152,6 +162,7 @@ function MentoringWithStepsBlock(runtime, element) {
cleanAll
();
showAssessmentMessage
();
showReviewStep
();
showAttempts
();
}
function
handleTryAgain
(
result
)
{
...
...
@@ -195,6 +206,7 @@ function MentoringWithStepsBlock(runtime, element) {
tryAgainDOM
.
on
(
'click'
,
tryAgain
);
assessmentMessageDOM
=
$
(
'.assessment-message'
,
element
);
attemptsDOM
=
$
(
'.attempts'
,
element
);
var
options
=
{
onChange
:
onChange
...
...
problem_builder/templates/html/mentoring_with_steps.html
View file @
c251a614
...
...
@@ -25,6 +25,11 @@
<input
type=
"button"
class=
"input-next"
value=
"Next Step"
disabled=
"disabled"
/>
<input
type=
"button"
class=
"input-review"
value=
"Review grade"
disabled=
"disabled"
/>
<input
type=
"button"
class=
"input-try-again"
value=
"Try again"
disabled=
"disabled"
/>
<div
class=
"attempts"
data-max_attempts=
"{{ self.max_attempts }}"
data-num_attempts=
"{{ self.num_attempts }}"
>
</div>
</div>
</div>
...
...
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