codecombat/app/views/TeachersView.coffee

34 lines
1.2 KiB
CoffeeScript
Raw Normal View History

AuthModal = require 'views/core/AuthModal'
RootView = require 'views/core/RootView'
2014-01-03 13:32:13 -05:00
template = require 'templates/teachers'
CreateAccountModal = require 'views/core/CreateAccountModal'
2014-01-03 13:32:13 -05:00
module.exports = class TeachersView extends RootView
2014-06-30 22:16:26 -04:00
id: 'teachers-view'
2014-01-03 13:32:13 -05:00
template: template
events:
'click .btn-create-account': 'onClickSignup'
'click .btn-login-account': 'onClickLogin'
'click .link-register': 'onClickSignup'
2015-12-02 16:23:07 -05:00
constructor: ->
super()
if me.isAnonymous()
_.defer ->
# Just go to /schools for now, that page is better than this one. TODO: figure out real URLs/flow/content.
application.router.navigate "/schools", trigger: true
2015-12-02 16:23:07 -05:00
unless me.isAnonymous()
_.defer ->
application.router.navigate "/teachers/courses", trigger: true
2015-12-02 16:23:07 -05:00
onClickLogin: (e) ->
@openModalView new AuthModal() if me.get('anonymous')
2015-12-02 20:10:19 -05:00
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Login'
onClickSignup: (e) ->
@openModalView new CreateAccountModal() if me.get('anonymous')
2015-12-02 20:10:19 -05:00
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Create'
logoutRedirectURL: false