mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-24 21:13:35 -04:00
Added more info email field to employer signup
This commit is contained in:
parent
21e7487132
commit
84601d2927
2 changed files with 48 additions and 15 deletions
app
|
@ -10,16 +10,31 @@ block modal-body-content
|
|||
if userIsAnonymous
|
||||
if userIsAuthorized
|
||||
| You appear to be authorized on CodeCombat with LinkedIn.
|
||||
else if sentMoreInfoEmail
|
||||
| Thanks! You should receive an email from George shortly.
|
||||
else
|
||||
h4(data-i18n="employer_signup.sub_heading") Let us find your next brilliant developers.
|
||||
p Create an account to get started!
|
||||
.form
|
||||
.form#signup-form
|
||||
.form-group
|
||||
label.control-label(for="signup-email", data-i18n="general.email") Email
|
||||
input#signup-email.form-control.input-large(name="email",type="email")
|
||||
.form-group
|
||||
label.control-label(for="signup-password", data-i18n="general.password") Password
|
||||
input#signup-password.input-large.form-control(name="password", type="password")
|
||||
.modal-footer.linkedin
|
||||
button.btn.btn-primary(id="create-account-button") Create Account
|
||||
br
|
||||
br
|
||||
| Already have a CodeCombat account?
|
||||
a.login-link(data-toggle="coco-modal", data-target="modal/auth") Log in to continue!
|
||||
h4 Want more information first?
|
||||
p Enter your email and George, our CEO, will contact you shortly.
|
||||
.form
|
||||
.form-group
|
||||
label.control-label(for="more-info-email", data-i18n="general.email") Email
|
||||
input#more-info-email.form-control.input-large(name="more-info-email",type="email")
|
||||
button.btn.btn-primary(id="more-info-button") Send me more information!
|
||||
else if !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
p Please sign into your LinkedIn account to verify your identity.
|
||||
|
@ -44,14 +59,7 @@ block modal-body-content
|
|||
| By clicking Agree, you are agreeing to CodeCombat's Placement Agreement on behalf of your company. You also consent to CodeCombat storing basic LinkedIn profile data for verification purposes, including your name, email, public profile URL, and work history.
|
||||
block modal-footer
|
||||
if userIsAnonymous
|
||||
if !userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
button.btn.btn-primary(id="create-account-button") Create Account
|
||||
br
|
||||
br
|
||||
| Already have a CodeCombat account?
|
||||
a.login-link(data-toggle="coco-modal", data-target="modal/auth") Log in to continue!
|
||||
else
|
||||
if userIsAuthorized
|
||||
.modal-footer.linkedin
|
||||
a.login-link(data-toggle="coco-modal", data-target="modal/auth") Please log in to continue.
|
||||
else if !userIsAnonymous && !userIsAuthorized
|
||||
|
|
|
@ -19,6 +19,7 @@ module.exports = class EmployerSignupView extends View
|
|||
events:
|
||||
"click #contract-agreement-button": "agreeToContract"
|
||||
"click #create-account-button": "createAccount"
|
||||
"click #more-info-button": "submitMoreInfoEmail"
|
||||
"click .login-link": "setHashToOpenModalAutomatically"
|
||||
"keydown": "checkForFormSubmissionEnterPress"
|
||||
|
||||
|
@ -30,6 +31,7 @@ module.exports = class EmployerSignupView extends View
|
|||
@reloadWhenClosed = false
|
||||
@linkedinLoaded = Boolean(IN.parse)
|
||||
@waitingForLinkedIn = false
|
||||
@sentMoreInfoEmail = false
|
||||
window.contractCallback = =>
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
@render()
|
||||
|
@ -59,6 +61,7 @@ module.exports = class EmployerSignupView extends View
|
|||
context.userIsAuthorized = @authorizedWithLinkedIn
|
||||
context.userHasSignedContract = "employer" in me.get("permissions")
|
||||
context.userIsAnonymous = context.me.get('anonymous')
|
||||
context.sentMoreInfoEmail = @sentMoreInfoEmail
|
||||
context
|
||||
|
||||
agreeToContract: ->
|
||||
|
@ -80,23 +83,45 @@ module.exports = class EmployerSignupView extends View
|
|||
alert "There was an error signing the contract. Please contact team@codecombat.com with this error: #{error.responseText}"
|
||||
|
||||
checkForFormSubmissionEnterPress: (e) ->
|
||||
if e.which is 13 then @createAccount(e)
|
||||
if e.which is 13
|
||||
if $("#signup-email").val() isnt '' and $("#signup-password").val() isnt ''
|
||||
@createAccount(e)
|
||||
else if $("#more-info-email").val() isnt ''
|
||||
@submitMoreInfoEmail e
|
||||
|
||||
createAccount: (e) =>
|
||||
window.tracker?.trackEvent 'Finished Employer Signup'
|
||||
el = $("#signup-form")
|
||||
e.stopPropagation()
|
||||
forms.clearFormAlerts(@$el)
|
||||
userObject = forms.formToObject @$el
|
||||
forms.clearFormAlerts(el)
|
||||
userObject = forms.formToObject el
|
||||
delete userObject.subscribe
|
||||
for key, val of me.attributes when key in ["preferredLanguage", "testGroupNumber", "dateCreated", "wizardColor1", "name", "music", "volume", "emails"]
|
||||
userObject[key] ?= val
|
||||
userObject.emails ?= {}
|
||||
userObject.emails.employerNotes = {enabled: true}
|
||||
res = tv4.validateMultiple userObject, User.schema
|
||||
return forms.applyErrorsToForm(@$el, res.errors) unless res.valid
|
||||
@enableModalInProgress(@$el)
|
||||
return forms.applyErrorsToForm(el, res.errors) unless res.valid
|
||||
@enableModalInProgress(el)
|
||||
auth.createUserWithoutReload userObject, null
|
||||
|
||||
|
||||
submitMoreInfoEmail: (e) =>
|
||||
emailAddress = $("#more-info-email").val()
|
||||
window.tracker?.trackEvent 'Employer requested more information.'
|
||||
successFunc = =>
|
||||
@sentMoreInfoEmail = true
|
||||
@render()
|
||||
errorFunc = =>
|
||||
alert("Something went wrong! Please contact team@codecombat.com for more information and inform them of this error.")
|
||||
$.ajax
|
||||
type: "POST"
|
||||
url: "/contact"
|
||||
data:
|
||||
email: emailAddress
|
||||
message: "THIS IS AN AUTOMATED MESSAGE FROM THE EMPLOYER SIGNUP FORM \n Please send me more info about hiring CodeCombat players."
|
||||
success: successFunc
|
||||
error: errorFunc
|
||||
|
||||
setHashToOpenModalAutomatically: (e) ->
|
||||
window.location.hash = "employerSignupLoggingIn"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue