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
509e5315
Commit
509e5315
authored
Mar 02, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
light-children: Re-rendering of units upon display
parent
bb863a3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
12 deletions
+37
-12
mentoring/light_children.py
+10
-0
static/js/mentoring.js
+27
-12
No files found.
mentoring/light_children.py
View file @
509e5315
...
...
@@ -151,6 +151,16 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
super
(
XBlockWithLightChildren
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
load_children_from_xml_content
()
@XBlock.json_handler
def
view
(
self
,
data
,
suffix
=
''
):
"""
Current HTML view of the XBlock, for refresh by client
"""
frag
=
self
.
student_view
({})
return
{
'html'
:
frag
.
content
,
}
class
LightChild
(
Plugin
,
LightChildrenMixin
):
"""
...
...
static/js/mentoring.js
View file @
509e5315
...
...
@@ -58,18 +58,33 @@ function MentoringBlock(runtime, element) {
}
}
$
(
element
).
find
(
'.submit'
).
bind
(
'click'
,
function
()
{
var
data
=
{};
var
children
=
getChildren
(
element
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
child
=
children
[
i
];
if
(
child
.
name
!==
undefined
)
{
data
[
child
.
name
]
=
callIfExists
(
child
,
'submit'
);
function
initXBlock
()
{
$
(
element
).
find
(
'.submit'
).
bind
(
'click'
,
function
()
{
var
data
=
{};
var
children
=
getChildren
(
element
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
var
child
=
children
[
i
];
if
(
child
.
name
!==
undefined
)
{
data
[
child
.
name
]
=
callIfExists
(
child
,
'submit'
);
}
}
}
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'submit'
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
)).
success
(
handleSubmitResults
);
});
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'submit'
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
(
data
)).
success
(
handleSubmitResults
);
});
renderProgress
();
}
function
handleRefreshResults
(
results
)
{
$
(
element
).
html
(
results
.
html
);
initXBlock
();
}
function
refreshXBlock
()
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'view'
);
$
.
post
(
handlerUrl
,
'{}'
).
success
(
handleRefreshResults
);
}
renderProgress
();
// We need to manually refresh, XBlocks are currently loaded together with the section
refreshXBlock
(
element
);
}
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