I"Z (function() { var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Quby.Models.Panel = (function(superClass) { extend(Panel, superClass); function Panel() { return Panel.__super__.constructor.apply(this, arguments); } Panel.prototype.defaults = function() { return { questions: new Quby.Collections.Questions, view: new Quby.Views.PanelView({ model: this }), panelId: null, initedShowsHidesCalled: false }; }; Panel.prototype.initialize = function() { var hidePanelTrigger, panelId, viewSelector; panelId = this.get('panelId'); viewSelector = "#" + panelId; if (panelId) { this.get("view").setElement($(viewSelector)[0]); } hidePanelTrigger = function() { return this.trigger("hidePanelCheck"); }; this.get("questions").on("hide", hidePanelTrigger, this); this.get("questions").on("unhide", hidePanelTrigger, this); this.get("questions").on("show", hidePanelTrigger, this); this.get("questions").on("unshow", hidePanelTrigger, this); this.on("hidePanelCheck", this.hidePanelCheck, this); return this.trigger("hidePanelCheck"); }; Panel.prototype.initShowsHides = function(allQuestions) { if (!this.get('initedShowsHidesCalled')) { this.set('initedShowsHidesCalled', true); return this.get("questions").each(function(question) { var options; options = question.get("options"); return options.each(function(option) { return option.initShowsHides(allQuestions); }); }); } }; Panel.prototype.hidePanelCheck = function() { if (this.hidden()) { if (!this.get("questions").noneVisible()) { return this.trigger("unhide"); } } else { if (this.get("questions").noneVisible()) { return this.trigger("hide"); } } }; Panel.prototype.hidden = function() { return this.get("view").hidden(); }; return Panel; })(Backbone.Model); }).call(this); :ET