mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Basic filtering
Only visas work
This commit is contained in:
parent
fe328a766b
commit
397140d9b0
2 changed files with 12 additions and 5 deletions
|
@ -98,7 +98,7 @@ block content
|
||||||
td(rowspan=2)
|
td(rowspan=2)
|
||||||
img.candidate-picture(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, height=50)
|
img.candidate-picture(src=candidate.getPhotoURL(50), alt=profile.name, title=profile.name, height=50)
|
||||||
td.candidate-description #{profile.shortDescription}
|
td.candidate-description #{profile.shortDescription}
|
||||||
tr.border_row
|
tr.border_row(data-candidate-id=candidate.id)
|
||||||
if curated
|
if curated
|
||||||
- var workHistory = curated.workHistory.join(",");
|
- var workHistory = curated.workHistory.join(",");
|
||||||
td.tag_column
|
td.tag_column
|
||||||
|
|
|
@ -44,12 +44,15 @@ module.exports = class EmployersView extends View
|
||||||
name = input.attr 'name'
|
name = input.attr 'name'
|
||||||
if checked
|
if checked
|
||||||
that.filters[name] = _.union that.filters[name], [input.val()]
|
that.filters[name] = _.union that.filters[name], [input.val()]
|
||||||
@render()
|
@applyFilters()
|
||||||
resetFilters: ->
|
resetFilters: ->
|
||||||
for filterName, filterValues of @filters
|
for filterName, filterValues of @filters
|
||||||
@filters[filterName] = []
|
@filters[filterName] = []
|
||||||
|
|
||||||
applyFilters: (candidateList) ->
|
applyFilters: ->
|
||||||
|
candidateList = _.sortBy @candidates.models, (c) -> c.get('jobProfile').updated
|
||||||
|
candidateList = _.filter candidateList, (c) -> c.get('jobProfileApproved')
|
||||||
|
|
||||||
filteredCandidates = []
|
filteredCandidates = []
|
||||||
for filterName, filterValues of @filters
|
for filterName, filterValues of @filters
|
||||||
if filterName is "visa"
|
if filterName is "visa"
|
||||||
|
@ -63,6 +66,12 @@ module.exports = class EmployersView extends View
|
||||||
fieldValue = c.get('jobProfile').curated?[filterName]
|
fieldValue = c.get('jobProfile').curated?[filterName]
|
||||||
return _.contains filterValues, fieldValue
|
return _.contains filterValues, fieldValue
|
||||||
)
|
)
|
||||||
|
candidateIDsToShow = _.pluck filteredCandidates, 'id'
|
||||||
|
$("#candidate-table tr").each -> $(this).hide()
|
||||||
|
candidateIDsToShow.forEach (id) ->
|
||||||
|
$("[data-candidate-id=#{id}]").show()
|
||||||
|
|
||||||
|
|
||||||
return filteredCandidates
|
return filteredCandidates
|
||||||
setFilterDefaults: ->
|
setFilterDefaults: ->
|
||||||
@filters =
|
@filters =
|
||||||
|
@ -81,8 +90,6 @@ 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 = @applyFilters(ctx.featuredCandidates)
|
|
||||||
|
|
||||||
#ctx.featuredCandidates = _.filter ctx.featuredCandidates, (c) -> c.get('jobProfile').curated
|
#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.otherCandidates = _.reject ctx.activeCandidates, (c) -> c.get('jobProfileApproved')
|
||||||
|
|
Loading…
Reference in a new issue