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
ce8ae16d
Commit
ce8ae16d
authored
Sep 16, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display one step block at a time and add basic functionality for
navigating to next step.
parent
f839d587
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletions
+67
-1
problem_builder/mentoring.py
+4
-1
problem_builder/public/js/mentoring_with_steps.js
+46
-0
problem_builder/templates/html/mentoring_with_steps.html
+17
-0
No files found.
problem_builder/mentoring.py
View file @
ce8ae16d
...
@@ -865,16 +865,19 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
...
@@ -865,16 +865,19 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
fragment
.
add_frag_resources
(
child_fragment
)
fragment
.
add_frag_resources
(
child_fragment
)
child_content
+=
child_fragment
.
content
child_content
+=
child_fragment
.
content
fragment
.
add_content
(
loader
.
render_template
(
'templates/html/mentoring.html'
,
{
fragment
.
add_content
(
loader
.
render_template
(
'templates/html/mentoring
_with_steps
.html'
,
{
'self'
:
self
,
'self'
:
self
,
'title'
:
self
.
display_name
,
'title'
:
self
.
display_name
,
'show_title'
:
self
.
show_title
,
'show_title'
:
self
.
show_title
,
'child_content'
:
child_content
,
'child_content'
:
child_content
,
}))
}))
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/problem-builder.css'
))
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'
))
self
.
include_theme_files
(
fragment
)
self
.
include_theme_files
(
fragment
)
fragment
.
initialize_js
(
'MentoringWithStepsBlock'
)
return
fragment
return
fragment
@property
@property
...
...
problem_builder/public/js/mentoring_with_steps.js
0 → 100644
View file @
ce8ae16d
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
nextDOM
;
function
isLastChild
()
{
return
(
active_child
===
steps
.
length
-
1
);
}
function
hideAllSteps
()
{
for
(
var
i
=
0
;
i
<
steps
.
length
;
i
++
)
{
$
(
steps
[
i
].
element
).
hide
();
}
}
function
displayNextChild
()
{
hideAllSteps
();
findNextChild
();
if
(
isLastChild
())
{
nextDOM
.
attr
(
'disabled'
,
'disabled'
);
}
}
function
findNextChild
()
{
// find the next real child block to display. HTMLBlock are always displayed
++
active_child
;
var
child
=
steps
[
active_child
];
$
(
child
.
element
).
show
();
}
function
initXBlockView
()
{
displayNextChild
();
nextDOM
=
$
(
element
).
find
(
'.submit .input-next'
);
nextDOM
.
bind
(
'click'
,
displayNextChild
);
nextDOM
.
removeAttr
(
'disabled'
);
nextDOM
.
show
();
}
initXBlockView
();
}
problem_builder/templates/html/mentoring_with_steps.html
0 → 100644
View file @
ce8ae16d
{% load i18n %}
<div
class=
"mentoring themed-xblock"
data-step=
"{{ self.step }}"
>
{% if show_title and title %}
<div
class=
"title"
>
<h2>
{{ title }}
</h2>
</div>
{% endif %}
<div
class=
"assessment-question-block"
>
{{child_content|safe}}
<div
class=
"submit"
>
<input
type=
"button"
class=
"input-next"
value=
"Next Step"
disabled=
"disabled"
/>
</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