Merge pull request #1272 from codecombat/master

Various employer page changes
This commit is contained in:
Michael Schmatz 2014-07-07 10:42:43 -07:00
commit b449ca5224
8 changed files with 51 additions and 5 deletions

View file

@ -1,7 +1,12 @@
CocoModel = require 'models/CocoModel'
module.exports = class CocoCollection extends Backbone.Collection module.exports = class CocoCollection extends Backbone.Collection
loaded: false loaded: false
model: null
initialize: -> initialize: ->
if not @model
console.error @constructor.name, 'does not have a model defined. This will not do!'
super() super()
@once 'sync', => @once 'sync', =>
@loaded = true @loaded = true

View file

@ -21,14 +21,14 @@ module.exports = class User extends CocoModel
lang: -> lang: ->
@get('preferredLanguage') or 'en-US' @get('preferredLanguage') or 'en-US'
getPhotoURL: (size=80, useJobProfilePhoto=false) -> getPhotoURL: (size=80, useJobProfilePhoto=false, useEmployerPageAvatar=false) ->
photoURL = if useJobProfilePhoto then @get('jobProfile')?.photoURL else null photoURL = if useJobProfilePhoto then @get('jobProfile')?.photoURL else null
photoURL ||= @get('photoURL') photoURL ||= @get('photoURL')
if photoURL if photoURL
prefix = if photoURL.search(/\?/) is -1 then '?' else '&' prefix = if photoURL.search(/\?/) is -1 then '?' else '&'
return "#{photoURL}#{prefix}s=#{size}" if photoURL.search('http') isnt -1 # legacy return "#{photoURL}#{prefix}s=#{size}" if photoURL.search('http') isnt -1 # legacy
return "/file/#{photoURL}#{prefix}s=#{size}" return "/file/#{photoURL}#{prefix}s=#{size}"
return "/db/user/#{@id}/avatar?s=#{size}" return "/db/user/#{@id}/avatar?s=#{size}&employerPageAvatar=#{useEmployerPageAvatar}"
@getByID = (id, properties, force) -> @getByID = (id, properties, force) ->
{me} = require 'lib/auth' {me} = require 'lib/auth'

View file

@ -147,6 +147,10 @@ UserSchema = c.object {},
title: 'Seniority' title: 'Seniority'
type: 'string' type: 'string'
enum: ['College Student', 'Recent Grad', 'Junior', 'Senior', 'Management'] enum: ['College Student', 'Recent Grad', 'Junior', 'Senior', 'Management']
featured:
title: 'Featured'
type: 'boolean'
description: 'Should this candidate be prominently featured on the site?'
jobProfileApproved: {title: 'Job Profile Approved', type: 'boolean', description: 'Whether your profile has been approved by CodeCombat.'} jobProfileApproved: {title: 'Job Profile Approved', type: 'boolean', description: 'Whether your profile has been approved by CodeCombat.'}
jobProfileNotes: {type: 'string', maxLength: 1000, title: 'Our Notes', description: 'CodeCombat\'s notes on the candidate.', format: 'markdown', default: ''} jobProfileNotes: {type: 'string', maxLength: 1000, title: 'Our Notes', description: 'CodeCombat\'s notes on the candidate.', format: 'markdown', default: ''}
employerAt: c.shortString {description: 'If given employer permissions to view job candidates, for which employer?'} employerAt: c.shortString {description: 'If given employer permissions to view job candidates, for which employer?'}

View file

@ -0,0 +1,2 @@
#docs-components-view
color: saddlebrown

View file

@ -0,0 +1,6 @@
extends /templates/base
block content
ul
for component in components
li= component.get('name')

View file

@ -112,7 +112,7 @@ block content
tr.candidate-row(data-candidate-id=candidate.id, id=candidate.id, class=expired ? "expired" : "") tr.candidate-row(data-candidate-id=candidate.id, id=candidate.id, class=expired ? "expired" : "")
td(rowspan=2) td(rowspan=2)
.candidate-picture .candidate-picture
img(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, width=50) img(src=candidate.getPhotoURL(50,false,true), alt=profile.name, title=profile.name, width=50)
if curated && curated.shortDescription if curated && curated.shortDescription
td.candidate-description #{curated.shortDescription} td.candidate-description #{curated.shortDescription}
else else
@ -130,6 +130,7 @@ block content
img(src="/images/pages/employer/education.png") img(src="/images/pages/employer/education.png")
| #{curated.education} | #{curated.education}
td.work_column td.work_column
if workHistory
img(src="/images/pages/employer/briefcase.png") img(src="/images/pages/employer/briefcase.png")
| #{workHistory} | #{workHistory}
else else

View file

@ -0,0 +1,26 @@
RootView = require 'views/kinds/RootView'
template = require 'templates/docs/components'
CocoCollection = require 'collections/CocoCollection'
LevelComponent = require 'models/LevelComponent'
class ComponentDocsCollection extends CocoCollection
url: '/db/level.component?project=name,description,dependencies,propertyDocumentation'
model: LevelComponent
module.exports = class UnnamedView extends RootView
id: 'docs-components-view'
template: template
constructor: (options) ->
super(options)
@componentDocs = new ComponentDocsCollection()
@supermodel.loadCollection @componentDocs, 'components'
onLoaded: ->
console.log 'we have the components...', (c.get('name') for c in @componentDocs.models)
super()
getRenderData: ->
c = super()
c.components = @componentDocs.models
c

View file

@ -221,6 +221,8 @@ UserHandler = class UserHandler extends Handler
photoURL = document?.get('photoURL') photoURL = document?.get('photoURL')
if photoURL if photoURL
photoURL = "/file/#{photoURL}" photoURL = "/file/#{photoURL}"
else if req.query.employerPageAvatar is "true"
photoURL = @buildGravatarURL document, req.query.s, "/images/pages/employer/anon_user.png"
else else
photoURL = @buildGravatarURL document, req.query.s, req.query.fallback photoURL = @buildGravatarURL document, req.query.s, req.query.fallback
res.redirect photoURL res.redirect photoURL