X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fcore%2Fxoslib%2Fstatic%2Fjs%2Fxoslib%2FxosHelper.js;h=384a7ede437878977d497bfe61367df4f4ab290f;hb=dee21fb114a2ece37982e47d7b304b92c109cdd6;hp=6b6419c884d8a503653569ed8d03cc875e246d4a;hpb=fe290f49559b1e19b9251b83877862f70679bf86;p=plstackapi.git diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js index 6b6419c..384a7ed 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js +++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js @@ -4,6 +4,21 @@ HTMLView = Marionette.ItemView.extend({ }, }); +FilteredCompositeView = Marionette.CompositeView.extend( { + showCollection: function() { + var ChildView; + this.collection.each(function(child, index) { + filterFunc = this.options.filter || this.filter; + if (filterFunc && !filterFunc(child)) { + return; + } + ChildView = this.getChildView(child); + this.addChild(child, ChildView, index); + }, this); + + }, +}); + SliceSelectorOption = Marionette.ItemView.extend({ template: "#xos-sliceselector-option", tagName: "option", @@ -16,7 +31,7 @@ SliceSelectorOption = Marionette.ItemView.extend({ }, }); -SliceSelectorView = Marionette.CompositeView.extend({ +SliceSelectorView = FilteredCompositeView.extend({ template: "#xos-sliceselector-select", childViewContainer: "select", childView: SliceSelectorOption, @@ -39,20 +54,6 @@ SliceSelectorView = Marionette.CompositeView.extend({ templateHelpers: function() { return {caption: this.options.caption || this.caption }; }, }); -FilteredCompositeView = Marionette.CompositeView.extend( { - showCollection: function() { - var ChildView; - this.collection.each(function(child, index) { - if (this.filter && !this.filter(child)) { - return; - } - ChildView = this.getChildView(child); - this.addChild(child, ChildView, index); - }, this); - - }, -}); - XOSRouter = Marionette.AppRouter.extend({ initialize: function() { this.routeStack=[]; @@ -149,7 +150,7 @@ XOSApplication = Marionette.Application.extend({ if (parsed_error) { $("#xos-error-dialog").html(templateFromId("#xos-error-response")(parsed_error)); } else { - $("#xos-error-dialog").html(templateFromId("#xos-error-rawresponse")({responseText: responseText})) + $("#xos-error-dialog").html(templateFromId("#xos-error-rawresponse")({responseText: strip_scripts(responseText)})) } $("#xos-error-dialog").dialog({ @@ -672,6 +673,7 @@ XOSDetailView = Marionette.ItemView.extend({ model: this.model, detailView: this, choices: this.options.choices || this.choices || this.model.choices || {}, + helpText: this.options.helpText || this.helpText || this.model.helpText || {}, }}, });