mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Add logoutRedirectURL property to RootView, default to /, add exceptions
This commit is contained in:
parent
94cf5654ff
commit
53f8bca26b
7 changed files with 16 additions and 1 deletions
|
@ -51,7 +51,11 @@ module.exports.loginUser = (userObject, failure=genericFailure, nextURL=null) ->
|
||||||
module.exports.logoutUser = ->
|
module.exports.logoutUser = ->
|
||||||
FB?.logout?()
|
FB?.logout?()
|
||||||
callback = ->
|
callback = ->
|
||||||
window.location = '/hoc'
|
location = _.result(currentView, 'logoutRedirectURL')
|
||||||
|
if location
|
||||||
|
window.location = location
|
||||||
|
else
|
||||||
|
window.location.reload()
|
||||||
res = $.post('/auth/logout', {}, callback)
|
res = $.post('/auth/logout', {}, callback)
|
||||||
res.fail(genericFailure)
|
res.fail(genericFailure)
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,5 @@ template = require 'templates/about'
|
||||||
module.exports = class AboutView extends RootView
|
module.exports = class AboutView extends RootView
|
||||||
id: 'about-view'
|
id: 'about-view'
|
||||||
template: template
|
template: template
|
||||||
|
|
||||||
|
logoutRedirectURL: false
|
|
@ -17,3 +17,5 @@ module.exports = class CommunityView extends RootView
|
||||||
|
|
||||||
@$el.find('.logo-row img').each ->
|
@$el.find('.logo-row img').each ->
|
||||||
$(@).popover(placement: 'top', trigger: 'hover', container: 'body')
|
$(@).popover(placement: 'top', trigger: 'hover', container: 'body')
|
||||||
|
|
||||||
|
logoutRedirectURL: false
|
||||||
|
|
|
@ -25,3 +25,5 @@ module.exports = class SalesView extends RootView
|
||||||
onClickSignup: (e) ->
|
onClickSignup: (e) ->
|
||||||
@openModalView new AuthModal() if me.get('anonymous')
|
@openModalView new AuthModal() if me.get('anonymous')
|
||||||
window.tracker?.trackEvent 'Started Signup', category: 'Sales', label: 'Sales Create'
|
window.tracker?.trackEvent 'Started Signup', category: 'Sales', label: 'Sales Create'
|
||||||
|
|
||||||
|
logoutRedirectURL: false
|
||||||
|
|
|
@ -8,6 +8,7 @@ TrialRequest = require 'models/TrialRequest'
|
||||||
module.exports = class TeachersFreeTrialView extends RootView
|
module.exports = class TeachersFreeTrialView extends RootView
|
||||||
id: 'teachers-free-trial-view'
|
id: 'teachers-free-trial-view'
|
||||||
template: template
|
template: template
|
||||||
|
logoutRedirectURL: false
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click .submit-button': 'onClickSubmit'
|
'click .submit-button': 'onClickSubmit'
|
||||||
|
|
|
@ -24,3 +24,5 @@ module.exports = class TeachersView extends RootView
|
||||||
onClickSignup: (e) ->
|
onClickSignup: (e) ->
|
||||||
@openModalView new AuthModal() if me.get('anonymous')
|
@openModalView new AuthModal() if me.get('anonymous')
|
||||||
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Create'
|
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Create'
|
||||||
|
|
||||||
|
logoutRedirectURL: false
|
||||||
|
|
|
@ -171,3 +171,5 @@ module.exports = class RootView extends CocoView
|
||||||
console.warn 'Error saving language:', errors
|
console.warn 'Error saving language:', errors
|
||||||
res.success (model, response, options) ->
|
res.success (model, response, options) ->
|
||||||
#console.log 'Saved language:', newLang
|
#console.log 'Saved language:', newLang
|
||||||
|
|
||||||
|
logoutRedirectURL: '/'
|
Loading…
Reference in a new issue