Commit aa34c9d3 by Vasyl Nakvasiuk

remove 'passed' feature

parent a70cb2e1
......@@ -115,8 +115,7 @@ class ConditionalModule(XModule):
'message': message}
html = self.system.render_template('conditional_module.html',
context)
return json.dumps({'html': [html], 'passed': False,
'message': bool(message)})
return json.dumps({'html': [html], 'message': bool(message)})
if self.contents is None:
self.contents = [self.system.get_module(child_descriptor).get_html()
......@@ -124,7 +123,7 @@ class ConditionalModule(XModule):
html = self.contents
return json.dumps({'html': html, 'passed': True})
return json.dumps({'html': html})
def get_icon_class(self):
new_class = 'other'
......@@ -165,7 +164,7 @@ class ConditionalDescriptor(SequenceDescriptor):
if sources:
locations = [location.strip() for location in sources.split(';')]
for location in locations:
if Location.is_valid(location): # Check valid location url.
if Location.is_valid(location): # Check valid location url.
try:
if return_descriptor:
descriptor = system.load_item(location)
......
class @Conditional
constructor: (element, callerElId, reset) ->
constructor: (element, callerElId) ->
@el = $(element).find('.conditional-wrapper')
@callerElId = callerElId
if reset is true
@el.data('passed', null)
@passed = null
else
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
if callerElId isnt undefined
dependencies = @el.data('depends')
if (typeof dependencies is 'string') and (dependencies.length > 0) and (dependencies.indexOf(callerElId) is -1)
return
......@@ -26,24 +15,21 @@ class @Conditional
render: (element) ->
$.postWithPrefix "#{@url}/conditional_get", (response) =>
if (((response.passed is true) && (@passed is false)) || (@passed is null))
@el.data 'passed', response.passed
@el.html ''
@el.append(i) for i in response.html
@el.html ''
@el.append(i) for i in response.html
parentEl = $(element).parent()
parentId = parentEl.attr 'id'
parentEl = $(element).parent()
parentId = parentEl.attr 'id'
if response.message is false
if parentId.indexOf('vert') is 0
parentEl.hide()
else
$(element).hide()
if response.message is false
if parentId.indexOf('vert') is 0
parentEl.hide()
else
$(element).hide()
else
if parentId.indexOf('vert') is 0
parentEl.show()
else
if parentId.indexOf('vert') is 0
parentEl.show()
else
$(element).show()
$(element).show()
XModule.loadModules @el
XModule.loadModules @el
......@@ -104,7 +104,7 @@ PollMain.prototype = {
// notifying the constructor that this is a reset operation.
if (_this.wrapperSectionEl !== null) {
$(_this.wrapperSectionEl).find('.xmodule_ConditionalModule').each(function (index, value) {
new window.Conditional(value, _this.id.replace(/^poll_/, ''), true);
new window.Conditional(value, _this.id.replace(/^poll_/, ''));
});
}
}
......
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