mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
commit
6bd1dd000e
6 changed files with 45 additions and 14 deletions
|
@ -1,2 +1,5 @@
|
|||
#docs-modal .modal-dialog
|
||||
width: 800px
|
||||
width: 800px
|
||||
|
||||
a[data-toggle="tab"]
|
||||
cursor: pointer
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -230,7 +230,7 @@ module.exports = class PlayView extends View
|
|||
{
|
||||
name: 'Harvest Time'
|
||||
difficulty: 2
|
||||
id: 'find-the-spy'
|
||||
id: 'harvest-time'
|
||||
image: '/file/db/level/529662dfe0df8f0000000007/grab_the_mushroom_icon.png'
|
||||
description: "Collect a hundred mushrooms in just five lines of code - by Nathan Gossett"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue