Commit 0f200ae8 by Valera Rozuvan

Front end work for optimizing conditionals.

parent 44cf8482
class @Conditional
constructor: (element) ->
constructor: (element, callerElId) ->
@el = $(element).find('.conditional-wrapper')
if @el.data('passed') is true
@passed = true
@callerElId = callerElId
if @el.data('passed') is true
return
else if @el.data('passed') is false
@passed = false
else
@passed = null
if callerElId isnt undefined and @passed isnt null
console.log 'callerElId isnt undefined and @passed isnt null'
dependencies = @el.data('depends')
console.log 'dependencies: ', dependencies
console.log 'callerElId: ', callerElId
if (typeof dependencies is 'string') and (dependencies.length > 0) and (dependencies.indexOf(callerElId) is -1)
console.log 'Caller ID was not found in the dependencies.'
return
@url = @el.data('url')
@render(element)
......
......@@ -53,7 +53,7 @@ PollMain.prototype = {
if (_this.wrapperSectionEl !== null) {
$(_this.wrapperSectionEl).find('.xmodule_ConditionalModule').each(function (index, value) {
new window.Conditional(value);
new window.Conditional(value, _this.id);
});
}
}
......
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