mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-03 09:23:41 -04:00
Fixed filter behavior
This commit is contained in:
parent
ae63461ef3
commit
538344094b
2 changed files with 12 additions and 5 deletions
|
@ -53,6 +53,11 @@ module.exports = class EmployersView extends View
|
||||||
that.filters[name] = _.union that.filters[name], [value]
|
that.filters[name] = _.union that.filters[name], [value]
|
||||||
else
|
else
|
||||||
that.filters[name] = _.difference that.filters[name], [value]
|
that.filters[name] = _.difference that.filters[name], [value]
|
||||||
|
|
||||||
|
for filterName, filterValues of @filters
|
||||||
|
if filterValues.length is 0
|
||||||
|
@filters[filterName] = @defaultFilters[filterName]
|
||||||
|
|
||||||
handleSelectAllChange: (e) ->
|
handleSelectAllChange: (e) ->
|
||||||
checkedState = e.currentTarget.checked
|
checkedState = e.currentTarget.checked
|
||||||
$("#filters :input").each ->
|
$("#filters :input").each ->
|
||||||
|
@ -95,7 +100,8 @@ module.exports = class EmployersView extends View
|
||||||
locationFilter: ['Bay Area', 'New York', 'Other US', 'International']
|
locationFilter: ['Bay Area', 'New York', 'Other US', 'International']
|
||||||
roleFilter: ['Web Developer', 'Software Developer', 'iOS Developer', 'Android Developer', 'Project Manager']
|
roleFilter: ['Web Developer', 'Software Developer', 'iOS Developer', 'Android Developer', 'Project Manager']
|
||||||
seniorityFilter: ['College Student', 'Recent Grad', 'Junior', 'Senior', 'Management']
|
seniorityFilter: ['College Student', 'Recent Grad', 'Junior', 'Senior', 'Management']
|
||||||
|
@defaultFilters = _.cloneDeep @filters
|
||||||
|
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
ctx = super()
|
ctx = super()
|
||||||
|
@ -104,8 +110,9 @@ module.exports = class EmployersView extends View
|
||||||
ctx.activeCandidates = _.filter ctx.candidates, (c) -> c.get('jobProfile').active
|
ctx.activeCandidates = _.filter ctx.candidates, (c) -> c.get('jobProfile').active
|
||||||
ctx.inactiveCandidates = _.reject 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 = _.filter ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
||||||
#ctx.featuredCandidates = _.filter ctx.featuredCandidates, (c) -> c.get('jobProfile').curated
|
unless @isEmployer() or me.isAdmin()
|
||||||
#ctx.featuredCandidates = ctx.featuredCandidates.slice(0,8)
|
ctx.featuredCandidates = _.filter ctx.featuredCandidates, (c) -> c.get('jobProfile').curated
|
||||||
|
ctx.featuredCandidates = ctx.featuredCandidates.slice(0,7)
|
||||||
ctx.otherCandidates = _.reject ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
ctx.otherCandidates = _.reject ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
||||||
ctx.remarks = {}
|
ctx.remarks = {}
|
||||||
ctx.remarks[remark.get('user')] = remark for remark in @remarks.models
|
ctx.remarks[remark.get('user')] = remark for remark in @remarks.models
|
||||||
|
|
|
@ -321,9 +321,9 @@ UserHandler = class UserHandler extends Handler
|
||||||
@sendSuccess(res, candidates)
|
@sendSuccess(res, candidates)
|
||||||
|
|
||||||
formatCandidate: (authorized, document) ->
|
formatCandidate: (authorized, document) ->
|
||||||
fields = if authorized then ['name', 'jobProfile', 'jobProfileApproved', 'photoURL', '_id'] else ['jobProfile', 'jobProfileApproved']
|
fields = if authorized then ['name', 'jobProfile', 'jobProfileApproved', 'photoURL', '_id'] else ['_id','jobProfile', 'jobProfileApproved']
|
||||||
obj = _.pick document.toObject(), fields
|
obj = _.pick document.toObject(), fields
|
||||||
obj.photoURL ||= obj.jobProfile.photoURL if authorized
|
obj.photoURL ||= obj.jobProfile.photoURL #if authorized
|
||||||
subfields = ['country', 'city', 'lookingFor', 'jobTitle', 'skills', 'experience', 'updated', 'active', 'shortDescription', 'curated', 'visa']
|
subfields = ['country', 'city', 'lookingFor', 'jobTitle', 'skills', 'experience', 'updated', 'active', 'shortDescription', 'curated', 'visa']
|
||||||
if authorized
|
if authorized
|
||||||
subfields = subfields.concat ['name']
|
subfields = subfields.concat ['name']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue