Commit 65b3f583 by kimth

jsloader works at module-level

parent cbd602b4
......@@ -27,7 +27,7 @@ class @Problem
@$('section.action input.save').click @save
# Collapsibles
JavascriptLoader.setCollapsibles()
JavascriptLoader.setCollapsibles(@el)
# Dynamath
@$('input.math').keyup(@refreshMath)
......
......@@ -3,14 +3,15 @@ class @JavascriptLoader
Set of library functions that provide common interface for javascript loading
for all module types
###
@setCollapsibles: () =>
console.log($('.collapsible section'))
$('.longform').hide();
$('.shortform').append('<a href="#" class="full">See full output</a>');
$('.collapsible section').hide();
$('.full').click @toggleFull
$('.collapsible header a').click @toggleHint
@toggleHint()
@setCollapsibles: (el) =>
###
el: jQuery object representing xmodule
###
el.find('.longform').hide();
el.find('.shortform').append('<a href="#" class="full">See full output</a>');
el.find('.collapsible section').hide();
el.find('.full').click @toggleFull
el.find('.collapsible header a').click @toggleHint
@toggleFull: (event) =>
$(event.target).parent().siblings().slideToggle()
......@@ -19,7 +20,6 @@ class @JavascriptLoader
$(this).text(text)
@toggleHint: (event) =>
console.log('toggleHint')
event.preventDefault()
$(event.target).parent().siblings().slideToggle()
$(event.target).parent().parent().toggleClass('open')
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