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
|
module.exports = LinkedInHandler = class LinkedInHandler extends CocoClass
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super()
|
super()
|
||||||
@linkedInData = {}
|
|
||||||
@loaded = false
|
|
||||||
subscriptions:
|
subscriptions:
|
||||||
'linkedin-loaded':'onLinkedInLoaded'
|
'linkedin-loaded':'onLinkedInLoaded'
|
||||||
|
|
||||||
onLinkedInLoaded: (e) =>
|
onLinkedInLoaded: (e) =>
|
||||||
console.log "Loaded LinkedIn!"
|
|
||||||
IN.Event.on IN, "auth", @onLinkedInAuth
|
IN.Event.on IN, "auth", @onLinkedInAuth
|
||||||
|
|
||||||
onLinkedInAuth: (e) => IN.API.Profile("me").result(@cacheProfileInformation)
|
onLinkedInAuth: (e) => console.log "Authorized with LinkedIn"
|
||||||
|
|
||||||
cacheProfileInformation: (profiles) =>
|
|
||||||
@linkedInData = profiles.values[0]
|
|
||||||
me.set("linkedIn", @linkedInData)
|
|
||||||
console.log "LinkedIn data is #{@linkedInData}"
|
|
||||||
|
|
||||||
constructEmployerAgreementObject: (cb) =>
|
constructEmployerAgreementObject: (cb) =>
|
||||||
IN.API.Profile("me")
|
IN.API.Profile("me")
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#employers-view
|
#employers-view
|
||||||
|
#see-candidates
|
||||||
|
cursor: pointer
|
||||||
.tablesorter
|
.tablesorter
|
||||||
//img
|
//img
|
||||||
// display: none
|
// display: none
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
h3(data-i18n="account_settings.job_profile") Job Profile
|
h3(data-i18n="account_settings.job_profile") Job Profile
|
||||||
script(type="in/Login")
|
|
||||||
Hello, <?js= firstName?> <?js= lastName?>.
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-9
|
.col-md-9
|
||||||
|
|
|
@ -15,7 +15,7 @@ block content
|
||||||
if !isEmployer
|
if !isEmployer
|
||||||
|
|
||||||
h3
|
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
|
if candidates.length
|
||||||
table.table.table-condensed.table-hover.table-responsive.tablesorter
|
table.table.table-condensed.table-hover.table-responsive.tablesorter
|
||||||
|
|
|
@ -22,16 +22,13 @@ module.exports = class EmployerSignupView extends View
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||||
#TODO: If IN.User.logout is called after authorizing, then the modal is reopened
|
window.tracker?.trackEvent 'Started Employer Signup'
|
||||||
# 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'
|
|
||||||
@reloadWhenClosed = false
|
@reloadWhenClosed = false
|
||||||
window.contractCallback = =>
|
window.contractCallback = =>
|
||||||
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
@authorizedWithLinkedIn = IN?.User?.isAuthorized()
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
onServerError: (e) -> # TODO: work error handling into a separate forms system
|
onServerError: (e) ->
|
||||||
@disableModalInProgress(@$el)
|
@disableModalInProgress(@$el)
|
||||||
|
|
||||||
afterInsert: ->
|
afterInsert: ->
|
||||||
|
@ -47,10 +44,8 @@ module.exports = class EmployerSignupView extends View
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
context = super()
|
context = super()
|
||||||
context.userIsAuthorized = @authorizedWithLinkedIn
|
context.userIsAuthorized = @authorizedWithLinkedIn
|
||||||
context.userHasSignedContract = false
|
context.userHasSignedContract = "employer" in me.get("permissions")
|
||||||
context.userIsAnonymous = context.me.get('anonymous')
|
context.userIsAnonymous = context.me.get('anonymous')
|
||||||
if @authorizedWithLinkedIn
|
|
||||||
context.firstName = application.linkedinHandler.linkedInData.firstName
|
|
||||||
context
|
context
|
||||||
|
|
||||||
agreeToContract: ->
|
agreeToContract: ->
|
||||||
|
@ -64,12 +59,15 @@ module.exports = class EmployerSignupView extends View
|
||||||
error: @handleAgreementFailure
|
error: @handleAgreementFailure
|
||||||
|
|
||||||
handleAgreementSuccess: (result) ->
|
handleAgreementSuccess: (result) ->
|
||||||
|
window.tracker?.trackEvent 'Employer Agreed to Contract'
|
||||||
me.fetch()
|
me.fetch()
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
|
|
||||||
handleAgreementFailure: (error) ->
|
handleAgreementFailure: (error) ->
|
||||||
|
alert "There was an error signing the contract. Please contact support with this error: #{error}"
|
||||||
|
|
||||||
createAccount: (e) =>
|
createAccount: (e) =>
|
||||||
|
window.tracker?.trackEvent 'Finished Employer Signup'
|
||||||
console.log "Tried to create account!"
|
console.log "Tried to create account!"
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
forms.clearFormAlerts(@$el)
|
forms.clearFormAlerts(@$el)
|
||||||
|
|
|
@ -17,7 +17,6 @@ module.exports = class LoginModalView extends View
|
||||||
events:
|
events:
|
||||||
"click #login-button": "loginAccount"
|
"click #login-button": "loginAccount"
|
||||||
"keydown #login-password": "loginAccount"
|
"keydown #login-password": "loginAccount"
|
||||||
"click #link-to-signup": "switchToSignup"
|
|
||||||
|
|
||||||
subscriptions:
|
subscriptions:
|
||||||
'server-error': 'onServerError'
|
'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')
|
if user.get('employerAt') or user.get('signedEmployerAgreement') or "employer" in user.get('permissions')
|
||||||
return errors.conflict(res, "You already have signed the agreement!")
|
return errors.conflict(res, "You already have signed the agreement!")
|
||||||
#TODO: Search for the current position
|
#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 =
|
signedEmployerAgreement =
|
||||||
linkedinID: profileData.id
|
linkedinID: profileData.id
|
||||||
date: new Date()
|
date: new Date()
|
||||||
|
|
Reference in a new issue