mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
Basic filtering functionality
Still has a few bugs
This commit is contained in:
parent
c6cc28b976
commit
fe328a766b
5 changed files with 145 additions and 11 deletions
app
server/users
|
@ -12,7 +12,19 @@
|
|||
vertical-align: text-bottom
|
||||
margin-left: 30px
|
||||
|
||||
|
||||
//filter panels
|
||||
#filter
|
||||
margin-bottom: 10px
|
||||
.panel-heading
|
||||
background-color: darkgrey
|
||||
.panel-body
|
||||
background-color: darkgrey
|
||||
|
||||
#filters
|
||||
.filter_section
|
||||
width: 16%
|
||||
display: inline-block
|
||||
vertical-align: top
|
||||
.get-started-button
|
||||
vertical-align: text-bottom
|
||||
margin-left: 10px
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#employers-wrapper
|
||||
background-color: #B4B4B4
|
||||
height: 100%
|
||||
#outer-content-wrapper, #intermediate-content-wrapper, #inner-content-wrapper
|
||||
background: #B4B4B4
|
||||
|
||||
|
@ -14,6 +15,7 @@
|
|||
border-top: none
|
||||
background-color: #B4B4B4
|
||||
padding-bottom: 50px
|
||||
|
||||
|
||||
#employer-content-area
|
||||
margin: auto
|
|
@ -1,11 +1,89 @@
|
|||
extends /templates/recruitment_base
|
||||
|
||||
block content
|
||||
#tagline
|
||||
h1(data-i18n="employers.hire_developers_not_credentials") Hire developers, not credentials.
|
||||
button.btn.get-started-button Get started
|
||||
|
||||
|
||||
if !isEmployer && !me.isAdmin()
|
||||
#tagline
|
||||
h1(data-i18n="employers.hire_developers_not_credentials") Hire developers, not credentials.
|
||||
button.btn.get-started-button Get started
|
||||
else
|
||||
#filter
|
||||
.panel-group#filter_panel
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
h4.panel-title
|
||||
a(data-toggle="collapse" data-target="#collapseOne" href="#collapseOne")
|
||||
span.glyphicon.glyphicon-folder-open
|
||||
| Filter
|
||||
.panel-collapse.collapse.in#collapseOne
|
||||
.panel-body
|
||||
form#filters
|
||||
.filter_section#screened_filter
|
||||
h4 Screened
|
||||
input(type="checkbox" name="phoneScreenFilter" value=true)
|
||||
| Phone Screened
|
||||
.filter_section#visa_filter
|
||||
h4 Visa
|
||||
input(type="checkbox" name="visa" value="Authorized to work in the US")
|
||||
| US Authorized
|
||||
br
|
||||
input(type="checkbox" name="visa" value="Need visa sponsorship")
|
||||
| Not Authorized
|
||||
.filter_section#school_filter
|
||||
h4 School
|
||||
input(type="checkbox" name="schoolFilter" value="Top 20 Eng.")
|
||||
| Top 20 Eng.
|
||||
br
|
||||
input(type="checkbox" name="schoolFilter" value="Other US")
|
||||
| Other US
|
||||
br
|
||||
input(type="checkbox" name="schoolFilter" value="Other Intl.")
|
||||
| Other Intl.
|
||||
.filter_section#location_filter
|
||||
h4 Location
|
||||
input(type="checkbox" name="locationFilter" value="Bay Area")
|
||||
| Bay Area
|
||||
br
|
||||
input(type="checkbox" name="locationFilter" value="New York")
|
||||
| New York
|
||||
br
|
||||
input(type="checkbox" name="locationFilter" value="Other US")
|
||||
| Other US
|
||||
br
|
||||
input(type="checkbox" name="locationFilter" value="International")
|
||||
| International
|
||||
.filter_section#role_filter
|
||||
h4 Role
|
||||
input(type="checkbox" name="roleFilter" value="Web Developer")
|
||||
| Web Developer
|
||||
br
|
||||
input(type="checkbox" name="roleFilter" value="Software Developer")
|
||||
| Software Developer
|
||||
br
|
||||
input(type="checkbox" name="roleFilter" value="iOS Developer")
|
||||
| iOS Developer
|
||||
br
|
||||
input(type="checkbox" name="roleFilter" value="Android Developer")
|
||||
| Android Developer
|
||||
br
|
||||
input(type="checkbox" name="roleFilter" value="Project Manager")
|
||||
| Project Developer
|
||||
.filter_section#seniority_filter
|
||||
h4 Seniority
|
||||
input(type="checkbox" name="seniorityFilter" value="College Student")
|
||||
| College Student
|
||||
br
|
||||
input(type="checkbox" name="seniorityFilter" value="Recent Grad")
|
||||
| Recent Grad
|
||||
br
|
||||
input(type="checkbox" name="seniorityFilter" value="Junior")
|
||||
| Junior
|
||||
br
|
||||
input(type="checkbox" name="seniorityFilter" value="Senior")
|
||||
| Senior
|
||||
br
|
||||
input(type="checkbox" name="seniorityFilter" value="Management")
|
||||
| Management
|
||||
|
||||
if candidates.length
|
||||
#candidate-table
|
||||
table
|
||||
|
@ -38,7 +116,7 @@ block content
|
|||
else
|
||||
td Hi
|
||||
|
||||
if (!isEmployer && !me.isAdmin()) || true
|
||||
if !isEmployer && !me.isAdmin()
|
||||
div#info_wrapper
|
||||
span.hiring-call-to-action
|
||||
h2#start-hiring(data-i18n="employers.start_hiring") Start hiring.
|
||||
|
|
|
@ -21,11 +21,13 @@ module.exports = class EmployersView extends View
|
|||
|
||||
events:
|
||||
'click tbody tr': 'onCandidateClicked'
|
||||
'change #filters input': 'onFilterChanged'
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
@getCandidates()
|
||||
|
||||
@setFilterDefaults()
|
||||
|
||||
afterRender: ->
|
||||
super()
|
||||
@sortTable() if @candidates.models.length
|
||||
|
@ -33,7 +35,45 @@ module.exports = class EmployersView extends View
|
|||
afterInsert: ->
|
||||
super()
|
||||
_.delay @checkForEmployerSignupHash, 500
|
||||
|
||||
onFilterChanged: (e) ->
|
||||
@resetFilters()
|
||||
that = @
|
||||
$("#filters :input").each ->
|
||||
input = $(this)
|
||||
checked = input.prop 'checked'
|
||||
name = input.attr 'name'
|
||||
if checked
|
||||
that.filters[name] = _.union that.filters[name], [input.val()]
|
||||
@render()
|
||||
resetFilters: ->
|
||||
for filterName, filterValues of @filters
|
||||
@filters[filterName] = []
|
||||
|
||||
applyFilters: (candidateList) ->
|
||||
filteredCandidates = []
|
||||
for filterName, filterValues of @filters
|
||||
if filterName is "visa"
|
||||
filteredCandidates = _.union filteredCandidates, _.filter(candidateList, (c) ->
|
||||
fieldValue = c.get('jobProfile').visa
|
||||
return _.contains filterValues, fieldValue
|
||||
)
|
||||
else
|
||||
filteredCandidates = _.union filteredCandidates, _.filter(candidateList, (c) ->
|
||||
unless c.get('jobProfile').curated then return false
|
||||
fieldValue = c.get('jobProfile').curated?[filterName]
|
||||
return _.contains filterValues, fieldValue
|
||||
)
|
||||
return filteredCandidates
|
||||
setFilterDefaults: ->
|
||||
@filters =
|
||||
phoneScreenFilter: [true]
|
||||
visa: ['Authorized to work in the US', 'Need visa sponsorship']
|
||||
schoolFilter: ['Top 20 Eng.', 'Other US', 'Other Intl.']
|
||||
locationFilter: ['Bay Area', 'New York', 'Other US', 'International']
|
||||
roleFilter: ['Web Developer', 'Software Developer', 'iOS Developer', 'Android Developer', 'Project Manager']
|
||||
seniorityFilter: ['College Student', 'Recent Grad', 'Junior', 'Senior', 'Management']
|
||||
|
||||
|
||||
getRenderData: ->
|
||||
ctx = super()
|
||||
ctx.isEmployer = @isEmployer()
|
||||
|
@ -41,8 +81,10 @@ module.exports = class EmployersView extends View
|
|||
ctx.activeCandidates = _.filter ctx.candidates, (c) -> c.get('jobProfile').active
|
||||
ctx.inactiveCandidates = _.reject ctx.candidates, (c) -> c.get('jobProfile').active
|
||||
ctx.featuredCandidates = _.filter ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
||||
ctx.featuredCandidates = @applyFilters(ctx.featuredCandidates)
|
||||
|
||||
#ctx.featuredCandidates = _.filter ctx.featuredCandidates, (c) -> c.get('jobProfile').curated
|
||||
ctx.featuredCandidates = ctx.featuredCandidates.slice(0,8)
|
||||
#ctx.featuredCandidates = ctx.featuredCandidates.slice(0,8)
|
||||
ctx.otherCandidates = _.reject ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
||||
ctx.remarks = {}
|
||||
ctx.remarks[remark.get('user')] = remark for remark in @remarks.models
|
||||
|
|
|
@ -324,7 +324,7 @@ UserHandler = class UserHandler extends Handler
|
|||
fields = if authorized then ['name', 'jobProfile', 'jobProfileApproved', 'photoURL', '_id'] else ['jobProfile', 'jobProfileApproved']
|
||||
obj = _.pick document.toObject(), fields
|
||||
obj.photoURL ||= obj.jobProfile.photoURL if authorized
|
||||
subfields = ['country', 'city', 'lookingFor', 'jobTitle', 'skills', 'experience', 'updated', 'active', 'shortDescription', 'curated']
|
||||
subfields = ['country', 'city', 'lookingFor', 'jobTitle', 'skills', 'experience', 'updated', 'active', 'shortDescription', 'curated', 'visa']
|
||||
if authorized
|
||||
subfields = subfields.concat ['name']
|
||||
obj.jobProfile = _.pick obj.jobProfile, subfields
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue