Add logoutRedirectURL property to RootView, default to /, add exceptions

This commit is contained in:
Scott Erickson 2015-12-18 10:02:03 -08:00
parent 94cf5654ff
commit 53f8bca26b
7 changed files with 16 additions and 1 deletions

View file

@ -51,7 +51,11 @@ module.exports.loginUser = (userObject, failure=genericFailure, nextURL=null) ->
module.exports.logoutUser = ->
FB?.logout?()
callback = ->
window.location = '/hoc'
location = _.result(currentView, 'logoutRedirectURL')
if location
window.location = location
else
window.location.reload()
res = $.post('/auth/logout', {}, callback)
res.fail(genericFailure)

View file

@ -4,3 +4,5 @@ template = require 'templates/about'
module.exports = class AboutView extends RootView
id: 'about-view'
template: template
logoutRedirectURL: false

View file

@ -17,3 +17,5 @@ module.exports = class CommunityView extends RootView
@$el.find('.logo-row img').each ->
$(@).popover(placement: 'top', trigger: 'hover', container: 'body')
logoutRedirectURL: false

View file

@ -25,3 +25,5 @@ module.exports = class SalesView extends RootView
onClickSignup: (e) ->
@openModalView new AuthModal() if me.get('anonymous')
window.tracker?.trackEvent 'Started Signup', category: 'Sales', label: 'Sales Create'
logoutRedirectURL: false

View file

@ -8,6 +8,7 @@ TrialRequest = require 'models/TrialRequest'
module.exports = class TeachersFreeTrialView extends RootView
id: 'teachers-free-trial-view'
template: template
logoutRedirectURL: false
events:
'click .submit-button': 'onClickSubmit'

View file

@ -24,3 +24,5 @@ module.exports = class TeachersView extends RootView
onClickSignup: (e) ->
@openModalView new AuthModal() if me.get('anonymous')
window.tracker?.trackEvent 'Started Signup', category: 'Teachers', label: 'Teachers Create'
logoutRedirectURL: false

View file

@ -171,3 +171,5 @@ module.exports = class RootView extends CocoView
console.warn 'Error saving language:', errors
res.success (model, response, options) ->
#console.log 'Saved language:', newLang
logoutRedirectURL: '/'