(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, 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; if (ELA.Views == null) { ELA.Views = {}; } ELA.Views.App = (function(superClass) { extend(App, superClass); function App() { this.render = bind(this.render, this); this.renderAbout = bind(this.renderAbout, this); this.activateSubviews = bind(this.activateSubviews, this); return App.__super__.constructor.apply(this, arguments); } App.prototype.initialize = function() { this.subviews = {}; this.listenTo(this.model, 'change:currentAppModel', this.render); return this.listenTo(this.model, 'change:showAbout', this.renderAbout); }; App.prototype.currentAppModel = function() { return this.model.currentAppModel(); }; App.prototype.activateSubviews = function() { var ref, ref1, ref2, ref3; if (this.currentAppModel()) { if ((ref = this.subviews.index) != null) { ref.deactivate(); } return (ref1 = this.subviews.app) != null ? ref1.activate() : void 0; } else { if ((ref2 = this.subviews.index) != null) { ref2.activate(); } return (ref3 = this.subviews.app) != null ? ref3.deactivate() : void 0; } }; App.prototype.loadedViewName = function() { var ref; return (ref = this.subviews.app) != null ? ref.model.name : void 0; }; App.prototype.currentAppModelName = function() { var ref; return (ref = this.model.currentAppModel()) != null ? ref.name : void 0; }; App.prototype.renderAbout = function() { var showAbout, view; showAbout = this.model.get('showAbout'); if (showAbout && (this.subviews.help == null)) { this.subviews.help = view = new ELA.Views.Help({ model: this.model }); this.$el.append(view.render().el); } return delay((function(_this) { return function() { var ref, ref1; if ((ref = _this.subviews.help) != null) { ref.setActive(showAbout); } return (ref1 = _this.subviews.index) != null ? ref1.setActive(!showAbout) : void 0; }; })(this)); }; App.prototype.render = function() { var AppView, view; if (this.subviews.index == null) { this.subviews.index = new ELA.Views.Overview(); this.$el.append(this.subviews.index.render().el); } if (this.subviews.app && this.loadedViewName() !== this.currentAppModelName()) { this.subviews.app.remove(); delete this.subviews.app; } if (this.model.currentAppModel() && (this.subviews.app == null)) { AppView = this.model.currentNamespace().Views.App; this.subviews.app = view = new AppView({ model: this.model.currentAppModel(), localePrefix: this.model.currentAppModel().localePrefix() }); this.$el.append(view.render().el); } this.renderAbout(); delay(this.activateSubviews); return this; }; return App; })(Backbone.View); }).call(this);