mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Loading active candidate profiles from the database into a table for employers.
This commit is contained in:
parent
5c8c7fff1d
commit
1b79de0d86
6 changed files with 86 additions and 17 deletions
|
@ -47,14 +47,44 @@ block content
|
|||
li more location
|
||||
li projects: list of pic, name, description, link (like http://www.folyo.me/designers/stanislav-udotov)
|
||||
|
||||
table.table.table-condensed.table-hover.table-responsive.tablesorter
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Location
|
||||
th Looking For
|
||||
// Remote, Full-time, Part-time, Contracting, Internship
|
||||
th Top 5 Skills
|
||||
th Yrs Exp
|
||||
th Last Updated
|
||||
th Current Job
|
||||
- var authorized = false; // testing
|
||||
if candidates.length
|
||||
table.table.table-condensed.table-hover.table-responsive.tablesorter
|
||||
thead
|
||||
tr
|
||||
th Name
|
||||
th Location
|
||||
th Looking For
|
||||
th Top 5 Skills
|
||||
th Yrs Exp
|
||||
th Last Updated
|
||||
th Current Job
|
||||
|
||||
tbody
|
||||
for candidate, index in candidates
|
||||
- var profile = candidate.get('jobProfile');
|
||||
- console.log(candidate.get('emailHash'));
|
||||
tr
|
||||
td
|
||||
if authorized
|
||||
img(src=candidate.getPhotoURL(), alt=profile.name, title=profile.name, width=50)
|
||||
p= profile.name
|
||||
else
|
||||
img(src="/images/pages/contribute/archmage.png", alt="", title="Sign up as an employer to see our candidates", width=50)
|
||||
p Developer ##{index + 1}
|
||||
if profile.country == 'USA'
|
||||
td= profile.city
|
||||
else
|
||||
td= profile.country
|
||||
td= profile.lookingFor
|
||||
td= profile.skills.slice(0, 5).join(', ')
|
||||
td= profile.experience
|
||||
td= moment(profile.updated).fromNow()
|
||||
if authorized
|
||||
if profile.work.length
|
||||
td= profile.work[0].role + ' at ' + profile.work[0].employer
|
||||
else
|
||||
td
|
||||
else
|
||||
td
|
||||
em Employer sign-up required.
|
||||
|
|
|
@ -142,5 +142,5 @@ module.exports = class SettingsView extends View
|
|||
updated = updated or jobProfile[key] isnt val
|
||||
jobProfile[key] = val
|
||||
if updated
|
||||
jobProfile.updated = new Date() # doesn't work
|
||||
#jobProfile.updated = new Date() # doesn't work
|
||||
me.set 'jobProfile', jobProfile
|
||||
|
|
|
@ -16,12 +16,12 @@ module.exports = class LevelSessionsView extends View
|
|||
@getLevelSessions()
|
||||
|
||||
getLevelSessions: ->
|
||||
@sessions = new LevelSessionCollection
|
||||
@sessions = new LevelSessionCollection()
|
||||
@sessions.fetch()
|
||||
@listenTo(@sessions, 'all', @render)
|
||||
@listenToOnce @sessions, 'all', @render
|
||||
|
||||
getRenderData: =>
|
||||
c = super()
|
||||
c.sessions = @sessions.models
|
||||
c.moment = moment
|
||||
c
|
||||
c
|
||||
|
|
|
@ -1,13 +1,36 @@
|
|||
View = require 'views/kinds/RootView'
|
||||
template = require 'templates/employers'
|
||||
|
||||
User = require 'models/User'
|
||||
CocoCollection = require 'models/CocoCollection'
|
||||
|
||||
class CandidatesCollection extends CocoCollection
|
||||
url: '/db/user/x/candidates'
|
||||
model: User
|
||||
|
||||
module.exports = class EmployersView extends View
|
||||
id: "employers-view"
|
||||
template: template
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
@getCandidates()
|
||||
|
||||
afterRender: ->
|
||||
@sortTable()
|
||||
super()
|
||||
@sortTable() if @candidates.models.length
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.candidates = @candidates.models
|
||||
c.moment = moment
|
||||
c
|
||||
|
||||
getCandidates: ->
|
||||
@candidates = new CandidatesCollection()
|
||||
@candidates.fetch()
|
||||
# Re-render when we have fetched them, but don't wait and show a progress bar while loading.
|
||||
@listenToOnce @candidates, 'all', @render
|
||||
|
||||
sortTable: ->
|
||||
# http://mottie.github.io/tablesorter/docs/example-widget-bootstrap-theme.html
|
||||
|
|
|
@ -171,6 +171,7 @@ UserHandler = class UserHandler extends Handler
|
|||
return @getNamesByIds(req, res) if args[1] is 'names'
|
||||
return @nameToID(req, res, args[0]) if args[1] is 'nameToID'
|
||||
return @getLevelSessions(req, res, args[0]) if args[1] is 'level.sessions'
|
||||
return @getCandidates(req, res) if args[1] is 'candidates'
|
||||
return @sendNotFoundError(res)
|
||||
|
||||
agreeToCLA: (req, res) ->
|
||||
|
@ -208,5 +209,20 @@ UserHandler = class UserHandler extends Handler
|
|||
documents = (@formatEntity(req, doc) for doc in documents)
|
||||
@sendSuccess(res, documents)
|
||||
|
||||
getCandidates: (req, res) ->
|
||||
authorized = req.user.isAdmin() or false # need some entry saying req.user is an employer
|
||||
return @sendUnauthorizedError(res) unless req.user.isAdmin()
|
||||
#query = {'jobProfileApproved': true, 'jobProfile.active': true}
|
||||
query = {'jobProfile.active': true}
|
||||
#query = {'email': 'livelily@gmail.com'}
|
||||
projection = {jobProfile: 1}
|
||||
if authorized
|
||||
projection.emailHash = 1
|
||||
console.log 'email hash', projection
|
||||
User.find(query).select(projection).exec (err, documents) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
documents = (@formatEntity(req, doc) for doc in documents)
|
||||
# TODO: anonymize user ids so you can't (indirectly) tell who they are unless you are authorized?
|
||||
@sendSuccess(res, documents)
|
||||
|
||||
module.exports = new UserHandler()
|
||||
|
|
|
@ -69,7 +69,7 @@ UserSchema = c.object {},
|
|||
shortDescription: {type: 'string', maxLength: 140, title: 'Short Description', description: 'Who are you, and what are you looking for? 140 characters max.', default: 'Programmer seeking to build great software.'}
|
||||
longDescription: {type: 'string', maxLength: 2000, title: 'Long Description', description: 'Give employeers more details. Highlight your stunning personality. Markdown okay. 2000 characters max.', format: 'markdown', default: '* I write great code.\n* You need great code?\n* Great!'}
|
||||
visa: c.shortString {title: 'US Work Status', description: 'Are you authorized to work in the US, or do you need visa sponsorship?', enum: ['Authorized to work in the US', 'Need visa sponsorship'], default: 'Authorized to work in the US'}
|
||||
work: c.array {title: 'Work Experience', description: 'List your relevant work experience.'},
|
||||
work: c.array {title: 'Work Experience', description: 'List your relevant work experience, most recent first.'},
|
||||
c.object {title: 'Job', description: 'Some work experience you had.', required: ['employer', 'role', 'duration']},
|
||||
employer: c.shortString {title: 'Employer', description: 'Name of your employer.'}
|
||||
role: c.shortString {title: 'Job Title', description: 'What was your job title or role?'}
|
||||
|
|
Loading…
Reference in a new issue