diff --git a/app/collections/CocoCollection.coffee b/app/collections/CocoCollection.coffee index 817b0700f..bb051811c 100644 --- a/app/collections/CocoCollection.coffee +++ b/app/collections/CocoCollection.coffee @@ -1,7 +1,12 @@ +CocoModel = require 'models/CocoModel' + module.exports = class CocoCollection extends Backbone.Collection loaded: false + model: null initialize: -> + if not @model + console.error @constructor.name, 'does not have a model defined. This will not do!' super() @once 'sync', => @loaded = true diff --git a/app/models/User.coffee b/app/models/User.coffee index 9766a85aa..1086e1373 100644 --- a/app/models/User.coffee +++ b/app/models/User.coffee @@ -21,14 +21,14 @@ module.exports = class User extends CocoModel lang: -> @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 ||= @get('photoURL') if photoURL prefix = if photoURL.search(/\?/) is -1 then '?' else '&' return "#{photoURL}#{prefix}s=#{size}" if photoURL.search('http') isnt -1 # legacy 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) -> {me} = require 'lib/auth' diff --git a/app/schemas/models/user.coffee b/app/schemas/models/user.coffee index a144494e1..b85d9f2bd 100644 --- a/app/schemas/models/user.coffee +++ b/app/schemas/models/user.coffee @@ -147,6 +147,10 @@ UserSchema = c.object {}, title: 'Seniority' type: 'string' 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.'} 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?'} diff --git a/app/styles/docs/components.sass b/app/styles/docs/components.sass new file mode 100644 index 000000000..177b11a39 --- /dev/null +++ b/app/styles/docs/components.sass @@ -0,0 +1,2 @@ +#docs-components-view + color: saddlebrown \ No newline at end of file diff --git a/app/templates/docs/components.jade b/app/templates/docs/components.jade new file mode 100644 index 000000000..20c3afb27 --- /dev/null +++ b/app/templates/docs/components.jade @@ -0,0 +1,6 @@ +extends /templates/base + +block content + ul + for component in components + li= component.get('name') \ No newline at end of file diff --git a/app/templates/employers.jade b/app/templates/employers.jade index 01f6debd7..790058be5 100644 --- a/app/templates/employers.jade +++ b/app/templates/employers.jade @@ -112,7 +112,7 @@ block content tr.candidate-row(data-candidate-id=candidate.id, id=candidate.id, class=expired ? "expired" : "") td(rowspan=2) .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 td.candidate-description #{curated.shortDescription} else @@ -130,8 +130,9 @@ block content img(src="/images/pages/employer/education.png") | #{curated.education} td.work_column - img(src="/images/pages/employer/briefcase.png") - | #{workHistory} + if workHistory + img(src="/images/pages/employer/briefcase.png") + | #{workHistory} else td Hi diff --git a/app/views/docs/components_view.coffee b/app/views/docs/components_view.coffee new file mode 100644 index 000000000..f80decee3 --- /dev/null +++ b/app/views/docs/components_view.coffee @@ -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 diff --git a/server/users/user_handler.coffee b/server/users/user_handler.coffee index ac43fda1c..f8b608255 100644 --- a/server/users/user_handler.coffee +++ b/server/users/user_handler.coffee @@ -221,6 +221,8 @@ UserHandler = class UserHandler extends Handler photoURL = document?.get('photoURL') if photoURL photoURL = "/file/#{photoURL}" + else if req.query.employerPageAvatar is "true" + photoURL = @buildGravatarURL document, req.query.s, "/images/pages/employer/anon_user.png" else photoURL = @buildGravatarURL document, req.query.s, req.query.fallback res.redirect photoURL