2015-11-29 07:02:45 -08:00
|
|
|
AuthModal = require 'views/core/AuthModal'
|
2014-11-28 17:49:41 -08:00
|
|
|
RootView = require 'views/core/RootView'
|
2014-01-03 10:32:13 -08:00
|
|
|
template = require 'templates/teachers'
|
2016-02-25 15:24:16 -08:00
|
|
|
CreateAccountModal = require 'views/core/CreateAccountModal'
|
2014-01-03 10:32:13 -08:00
|
|
|
|
2014-07-17 17:16:32 -07:00
|
|
|
module.exports = class TeachersView extends RootView
|
2014-07-01 10:16:26 +08:00
|
|
|
id: 'teachers-view'
|
2014-01-03 10:32:13 -08:00
|
|
|
template: template
|
2015-11-29 07:02:45 -08:00
|
|
|
|
|
|
|
events:
|
|
|
|
'click .btn-create-account': 'onClickSignup'
|
|
|
|
'click .btn-login-account': 'onClickLogin'
|
|
|
|
'click .link-register': 'onClickSignup'
|
|
|
|
|
2015-12-02 13:23:07 -08:00
|
|
|
constructor: ->
|
|
|
|
super()
|
2015-12-21 15:02:11 -08:00
|
|
|
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 13:23:07 -08:00
|
|
|
unless me.isAnonymous()
|
|
|
|
_.defer ->
|
2016-03-30 16:20:37 -07:00
|
|
|
application.router.navigate "/teachers/courses", trigger: true
|
2015-12-02 13:23:07 -08:00
|
|
|
|
2015-11-29 07:02:45 -08:00
|
|
|
onClickLogin: (e) ->
|
2016-02-25 15:24:16 -08:00
|
|
|
@openModalView new AuthModal() if me.get('anonymous')
|
2015-12-02 17:10:19 -08:00
|
|
|
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Login'
|
2015-11-29 07:02:45 -08:00
|
|
|
|
|
|
|
onClickSignup: (e) ->
|
2016-02-25 15:24:16 -08:00
|
|
|
@openModalView new CreateAccountModal() if me.get('anonymous')
|
2015-12-02 17:10:19 -08:00
|
|
|
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Create'
|
2015-12-18 10:02:03 -08:00
|
|
|
|
|
|
|
logoutRedirectURL: false
|