Sha256: acf69702788d6185a01c3829c5e399dbc5c182634542f408dfac937b20480b38
Contents?: true
Size: 1.49 KB
Versions: 19
Compression:
Stored size: 1.49 KB
Contents
ELA.Views ?= {} class ELA.Views.App extends Backbone.View initialize: -> @subviews = {} @listenTo @model, 'change:currentAppModel', @render @listenTo @model, 'change:showAbout', @renderAbout # @returns BaseApp or BaseSubappContainer currentAppModel: -> @model.currentAppModel() activateSubviews: => if @currentAppModel() @subviews.index?.deactivate() @subviews.app?.activate() else @subviews.index?.activate() @subviews.app?.deactivate() loadedViewName: -> @subviews.app?.model.name currentAppModelName: -> @model.currentAppModel()?.name renderAbout: => showAbout = @model.get('showAbout') if showAbout and not @subviews.help? @subviews.help = view = new ELA.Views.Help model: @model @$el.append(view.render().el) delay => @subviews.help?.setActive(showAbout) @subviews.index?.setActive(not showAbout) render: => unless @subviews.index? @subviews.index = new ELA.Views.Overview() @$el.append(@subviews.index.render().el) if @subviews.app and @loadedViewName() isnt @currentAppModelName() @subviews.app.remove() delete @subviews.app if @model.currentAppModel() and not @subviews.app? AppView = @model.currentNamespace().Views.App @subviews.app = view = new AppView model: @model.currentAppModel() localePrefix: @model.currentAppModel().localePrefix() @$el.append(view.render().el) @renderAbout() delay @activateSubviews this
Version data entries
19 entries across 19 versions & 1 rubygems