mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Various tweaks to employer signup
This commit is contained in:
parent
4f6f845c2d
commit
0dbcc861bf
7 changed files with 13 additions and 22 deletions
app
lib
styles
templates
views/modal
server/users
|
@ -7,21 +7,14 @@ storage = require 'lib/storage'
|
|||
module.exports = LinkedInHandler = class LinkedInHandler extends CocoClass
|
||||
constructor: ->
|
||||
super()
|
||||
@linkedInData = {}
|
||||
@loaded = false
|
||||
|
||||
subscriptions:
|
||||
'linkedin-loaded':'onLinkedInLoaded'
|
||||
|
||||
onLinkedInLoaded: (e) =>
|
||||
console.log "Loaded LinkedIn!"
|
||||
IN.Event.on IN, "auth", @onLinkedInAuth
|
||||
|
||||
onLinkedInAuth: (e) => IN.API.Profile("me").result(@cacheProfileInformation)
|
||||
|
||||
cacheProfileInformation: (profiles) =>
|
||||
@linkedInData = profiles.values[0]
|
||||
me.set("linkedIn", @linkedInData)
|
||||
console.log "LinkedIn data is #{@linkedInData}"
|
||||
onLinkedInAuth: (e) => console.log "Authorized with LinkedIn"
|
||||
|
||||
constructEmployerAgreementObject: (cb) =>
|
||||
IN.API.Profile("me")
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#employers-view
|
||||
#see-candidates
|
||||
cursor: pointer
|
||||
.tablesorter
|
||||
//img
|
||||
// display: none
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
h3(data-i18n="account_settings.job_profile") Job Profile
|
||||
script(type="in/Login")
|
||||
Hello, <?js= firstName?> <?js= lastName?>.
|
||||
|
||||
|
||||
.row
|
||||
.col-md-9
|
||||
|
|
|
@ -15,7 +15,7 @@ block content
|
|||
if !isEmployer
|
||||
|
||||
h3
|
||||
a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="modal/employer_signup") Click here to see candidates
|
||||
a#see-candidates(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="modal/employer_signup") Click here to see candidates
|
||||
|
||||
if candidates.length
|
||||
table.table.table-condensed.table-hover.table-responsive.tablesorter
|
||||
|
|
|
@ -22,16 +22,13 @@ module.exports = class EmployerSignupView extends View
|
|||
constructor: (options) ->
|
||||
super(options)
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
#TODO: If IN.User.logout is called after authorizing, then the modal is reopened
|
||||
# and the user reauths, there will be a javascript error due to the
|
||||
# contract callback context not finding @render
|
||||
#window.tracker?.trackEvent 'Started Employer Signup'
|
||||
window.tracker?.trackEvent 'Started Employer Signup'
|
||||
@reloadWhenClosed = false
|
||||
window.contractCallback = =>
|
||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||
@render()
|
||||
|
||||
onServerError: (e) -> # TODO: work error handling into a separate forms system
|
||||
onServerError: (e) ->
|
||||
@disableModalInProgress(@$el)
|
||||
|
||||
afterInsert: ->
|
||||
|
@ -47,10 +44,8 @@ module.exports = class EmployerSignupView extends View
|
|||
getRenderData: ->
|
||||
context = super()
|
||||
context.userIsAuthorized = @authorizedWithLinkedIn
|
||||
context.userHasSignedContract = false
|
||||
context.userHasSignedContract = "employer" in me.get("permissions")
|
||||
context.userIsAnonymous = context.me.get('anonymous')
|
||||
if @authorizedWithLinkedIn
|
||||
context.firstName = application.linkedinHandler.linkedInData.firstName
|
||||
context
|
||||
|
||||
agreeToContract: ->
|
||||
|
@ -64,12 +59,15 @@ module.exports = class EmployerSignupView extends View
|
|||
error: @handleAgreementFailure
|
||||
|
||||
handleAgreementSuccess: (result) ->
|
||||
window.tracker?.trackEvent 'Employer Agreed to Contract'
|
||||
me.fetch()
|
||||
window.location.reload()
|
||||
|
||||
handleAgreementFailure: (error) ->
|
||||
alert "There was an error signing the contract. Please contact support with this error: #{error}"
|
||||
|
||||
createAccount: (e) =>
|
||||
window.tracker?.trackEvent 'Finished Employer Signup'
|
||||
console.log "Tried to create account!"
|
||||
e.stopPropagation()
|
||||
forms.clearFormAlerts(@$el)
|
||||
|
|
|
@ -17,7 +17,6 @@ module.exports = class LoginModalView extends View
|
|||
events:
|
||||
"click #login-button": "loginAccount"
|
||||
"keydown #login-password": "loginAccount"
|
||||
"click #link-to-signup": "switchToSignup"
|
||||
|
||||
subscriptions:
|
||||
'server-error': 'onServerError'
|
||||
|
|
|
@ -243,7 +243,7 @@ UserHandler = class UserHandler extends Handler
|
|||
if user.get('employerAt') or user.get('signedEmployerAgreement') or "employer" in user.get('permissions')
|
||||
return errors.conflict(res, "You already have signed the agreement!")
|
||||
#TODO: Search for the current position
|
||||
employerAt = profileData.positions.values[0].company.name
|
||||
employerAt = _.filter(profileData.positions.values,"isCurrent")[0]?.company.name ? "Not available"
|
||||
signedEmployerAgreement =
|
||||
linkedinID: profileData.id
|
||||
date: new Date()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue