Commit 604a79dc by Piotr Mitros

Multiple per page works

parent 2aa07457
......@@ -63,9 +63,11 @@ class DoneXBlock(XBlock):
if self.align.lower() == "right":
grow_right = 0
frag.add_css(".done_left_spacer {{ flex-grow:{l}; }} .done_right_spacer {{ flex-grow:{r}; }}".format(r=grow_right, l=grow_left))
frag.add_javascript("var done_done = "+("true" if self.done else "false")+";")
frag.add_javascript(self.resource_string("static/js/src/done.js"))
frag.initialize_js('DoneXBlock')
if self.done:
frag.initialize_js("DoneXBlockOn")
else:
frag.initialize_js("DoneXBlockOff")
return frag
# TO-DO: change this to create the scenarios you'd like to see in the
......@@ -77,6 +79,7 @@ class DoneXBlock(XBlock):
("DoneXBlock",
"""<vertical_demo>
<done align="left"> </done>
<done align="left"> </done>
</vertical_demo>
"""),
]
......
function DoneXBlockOn(runtime, element) {
$('.done_windshield', element).addClass("done_windshield_off").removeClass("done_windshield_on");
DoneXBlock(runtime, element);
}
function DoneXBlockOff(runtime, element) {
console.log("b");
$('.done_windshield', element).addClass("done_windshield_on").removeClass("done_windshield_off");
DoneXBlock(runtime, element);
}
function DoneXBlock(runtime, element) {
var handlerUrl = runtime.handlerUrl(element, 'toggle_button');
function updateCount(result) {}
$(function ($) {
if (done_done) {
$('.done_windshield', element).addClass("done_windshield_off").removeClass("done_windshield_on");
} else {
$('.done_windshield', element).addClass("done_windshield_on").removeClass("done_windshield_off");
}
// Don't have animations on for above class changes. This is probably not necessary. I
// was seeing animations on page load. I did a few things to fix it. The line below
// wasn't the one that fixed it, but I decided to keep it anyways.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment