codecombat/app/views/HomeView.coffee

32 lines
1,020 B
CoffeeScript
Raw Normal View History

RootView = require 'views/kinds/RootView'
2014-01-03 13:32:13 -05:00
template = require 'templates/home'
WizardSprite = require 'lib/surface/WizardSprite'
ThangType = require 'models/ThangType'
Simulator = require 'lib/simulator/Simulator'
2014-03-16 19:59:48 -04:00
{me} = require '/lib/auth'
2014-01-03 13:32:13 -05:00
module.exports = class HomeView extends RootView
2014-01-03 13:32:13 -05:00
id: 'home-view'
template: template
events:
'click #beginner-campaign': 'onClickBeginnerCampaign'
2014-01-03 13:32:13 -05:00
getRenderData: ->
c = super()
if $.browser
majorVersion = $.browser.versionNumber
2014-01-03 13:32:13 -05:00
c.isOldBrowser = true if $.browser.mozilla && majorVersion < 21
c.isOldBrowser = true if $.browser.chrome && majorVersion < 17
c.isOldBrowser = true if $.browser.safari && majorVersion < 6
2014-01-03 13:32:13 -05:00
else
console.warn 'no more jquery browser version...'
2014-03-16 19:59:48 -04:00
c.isEnglish = (me.get('preferredLanguage') or 'en').startsWith 'en'
2014-04-09 01:50:13 -04:00
c.languageName = me.get('preferredLanguage')
2014-01-03 13:32:13 -05:00
c
onClickBeginnerCampaign: (e) ->
e.preventDefault()
e.stopImmediatePropagation()
window.open '/play', '_blank'