mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
8a6bec9d40
4 changed files with 40 additions and 12 deletions
|
@ -46,8 +46,7 @@ block modal-footer
|
|||
if userIsAnonymous
|
||||
if !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
b.signin-text Sign in with LinkedIn to complete the registration process.
|
||||
script(type="in/Login" id="linkedInAuthButton" data-onAuth="contractCallback")
|
||||
button.btn.btn-primary(id="create-account-button") Create Account
|
||||
br
|
||||
br
|
||||
| Already have a CodeCombat account?
|
||||
|
@ -57,7 +56,6 @@ block modal-footer
|
|||
a.login-link(data-toggle="coco-modal", data-target="modal/login") Please log in to continue.
|
||||
else if !userIsAnonymous && !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
| We will record your name and work history for verification purposes.
|
||||
else if userIsAuthorized && !userHasSignedContract
|
||||
.modal-footer.linkedin
|
||||
button.btn.btn-primary(id="contract-agreement-button") I agree
|
||||
|
|
|
@ -20,7 +20,9 @@ module.exports = class ProfileView extends View
|
|||
@user = me
|
||||
else
|
||||
@user = User.getByID(@userID)
|
||||
@addResourceToLoad @user, 'user_profile'
|
||||
@user.fetch()
|
||||
@listenTo @user, "sync", =>
|
||||
@render()
|
||||
|
||||
getRenderData: ->
|
||||
context = super()
|
||||
|
|
|
@ -21,10 +21,19 @@ module.exports = class EmployersView extends View
|
|||
super options
|
||||
@getCandidates()
|
||||
|
||||
|
||||
checkForEmployerSignupHash: =>
|
||||
if window.location.hash is "#employerSignupLoggingIn"
|
||||
@openModalView application.router.getView("modal/employer_signup","_modal")
|
||||
window.location.hash = ""
|
||||
afterRender: ->
|
||||
super()
|
||||
@sortTable() if @candidates.models.length
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
_.delay @checkForEmployerSignupHash, 500
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.candidates = @candidates.models
|
||||
|
|
|
@ -13,10 +13,13 @@ module.exports = class EmployerSignupView extends View
|
|||
|
||||
subscriptions:
|
||||
"server-error": "onServerError"
|
||||
"created-user-without-reload": "linkedInAuth"
|
||||
'linkedin-loaded': 'onLinkedInLoaded'
|
||||
"created-user-without-reload": 'createdAccount'
|
||||
|
||||
events:
|
||||
"click #contract-agreement-button": "agreeToContract"
|
||||
"click #create-account-button": "createAccount"
|
||||
"click .login-link": "setHashToOpenModalAutomatically"
|
||||
|
||||
|
||||
constructor: (options) ->
|
||||
|
@ -24,20 +27,31 @@ module.exports = class EmployerSignupView extends View
|
|||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
window.tracker?.trackEvent 'Started Employer Signup'
|
||||
@reloadWhenClosed = false
|
||||
@linkedinLoaded = Boolean(IN.parse)
|
||||
@waitingForLinkedIn = false
|
||||
window.contractCallback = =>
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
@render()
|
||||
|
||||
onLinkedInLoaded: =>
|
||||
@linkedinLoaded = true
|
||||
if @waitingForLinkedIn
|
||||
@renderLinkedInButton()
|
||||
|
||||
renderLinkedInButton: =>
|
||||
IN.parse()
|
||||
|
||||
onServerError: (e) ->
|
||||
@disableModalInProgress(@$el)
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
linkedInButtonParentElement = document.getElementById("linkedInAuthButton")?.parentNode
|
||||
linkedInButtonParentElement = document.getElementById("linkedInAuthButton")
|
||||
if linkedInButtonParentElement
|
||||
IN.parse()
|
||||
if me.get('anonymous')
|
||||
$(".IN-widget").get(0).addEventListener('click', @createAccount, true)
|
||||
if @linkedinLoaded
|
||||
@renderLinkedInButton()
|
||||
else
|
||||
@waitingForLinkedIn = true
|
||||
|
||||
getRenderData: ->
|
||||
context = super()
|
||||
|
@ -78,11 +92,16 @@ module.exports = class EmployerSignupView extends View
|
|||
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
||||
@enableModalInProgress(@$el)
|
||||
auth.createUserWithoutReload userObject, null
|
||||
IN.User.authorize @render, @
|
||||
|
||||
linkedInAuth: (e) ->
|
||||
me.fetch()
|
||||
setHashToOpenModalAutomatically: (e) ->
|
||||
window.location.hash = "employerSignupLoggingIn"
|
||||
|
||||
createdAccount: ->
|
||||
@reloadWhenClosed = true
|
||||
@listenTo me,"sync", =>
|
||||
@render()
|
||||
IN.parse()
|
||||
me.fetch()
|
||||
|
||||
destroy: ->
|
||||
reloadWhenClosed = @reloadWhenClosed
|
||||
|
|
Loading…
Reference in a new issue