Added a way to set titles for RootViews. In development, titles show what RootView class you're looking at.

This commit is contained in:
Scott Erickson 2014-10-03 10:45:01 -07:00
parent d65ade7a97
commit 3305a3d7db
2 changed files with 11 additions and 0 deletions
app/views

View file

@ -59,6 +59,8 @@ module.exports = class LevelEditView extends RootView
showLoading: ($el) ->
$el ?= @$el.find('.outer-content')
super($el)
getTitle: -> "LevelEditor - " + (@level.get('name') or '...')
onLoaded: ->
_.defer =>

View file

@ -78,6 +78,15 @@ module.exports = class RootView extends CocoView
@buildLanguages()
$('body').removeClass('is-playing')
if application.isProduction()
title = 'CodeCombat - ' + (@getTitle() or 'Learn how to code by playing a game')
else
title = @getTitle() or @constructor.name
$('title').text(title)
getTitle: -> ''
chooseTab: (category) ->
$("a[href='##{category}']", @$el).tab('show')