This commit is contained in:
Scott Erickson 2014-04-24 11:22:50 -07:00
commit 1eb2adbc61
4 changed files with 103 additions and 18 deletions

View file

@ -27,3 +27,10 @@
margin: 2px 0
display: inline-block
text-transform: lowercase
td:nth-child(3) select
min-width: 100px
td:nth-child(6) select
min-width: 50px
td:nth-child(7) select
min-width: 100px

View file

@ -27,8 +27,8 @@ block content
th(data-i18n="employers.candidate_years_experience") Yrs Exp
th(data-i18n="employers.candidate_last_updated") Last Updated
if me.isAdmin()
th ?
th ಥ_ಥ
th Us?
th Them?
tbody
for candidate, index in candidates
@ -53,13 +53,13 @@ block content
code= skill
span
td= profile.experience
td= moment(profile.updated).fromNow()
td(data-profile-age=(new Date() - new Date(profile.updated)) / 86400 / 1000)= moment(profile.updated).fromNow()
if me.isAdmin()
if candidate.get('jobProfileApproved')
td ✓
else
td ✗
if profile.active
td ᶘ ᵒᴥᵒᶅ
td
else
td ⨂_⨂
td

View file

@ -56,27 +56,105 @@ module.exports = class EmployersView extends View
even: "" # odd row zebra striping
odd: "" # even row zebra striping
# e = exact text from cell
# n = normalized value returned by the column parser
# f = search filter input value
# i = column index
# $r = ???
filterSelectExactMatch = (e, n, f, i, $r) -> e is f
# call the tablesorter plugin and apply the uitheme widget
@$el.find(".tablesorter").tablesorter(
@$el.find(".tablesorter").tablesorter
theme: "bootstrap"
widthFixed: true
headerTemplate: "{content} {icon}"
textSorter:
6: (a, b, direction, column, table) ->
days = []
for s in [a, b]
n = parseInt s
n = 0 unless _.isNumber n
for [duration, factor] in [
[/second/i, 1 / (86400 * 1000)]
[/minute/i, 1 / 1440]
[/hour/i, 1 / 24]
[/week/i, 7]
[/month/i, 30.42]
[/year/i, 365.2425]
]
if duration.test s
n *= factor
break
if /^in /i.test s
n *= -1
days.push n
days[0] - days[1]
sortList: [[6, 0]]
# widget code contained in the jquery.tablesorter.widgets.js file
# use the zebra stripe widget if you plan on hiding any rows (filter widget)
widgets: [
"uitheme"
"zebra"
]
widgets: ["uitheme", "zebra", "filter"]
widgetOptions:
# using the default zebra striping class name, so it actually isn't included in the theme variable above
# this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden
zebra: [
"even"
"odd"
]
# reset filters button
zebra: ["even", "odd"]
# extra css class applied to the table row containing the filters & the inputs within that row
filter_cssFilter: ""
# If there are child rows in the table (rows with class name from "cssChildRow" option)
# and this option is true and a match is found anywhere in the child row, then it will make that row
# visible; default is false
filter_childRows: false
# if true, filters are collapsed initially, but can be revealed by hovering over the grey bar immediately
# below the header row. Additionally, tabbing through the document will open the filter row when an input gets focus
filter_hideFilters: false
# Set this option to false to make the searches case sensitive
filter_ignoreCase: true
# jQuery selector string of an element used to reset the filters
filter_reset: ".reset"
)
# Use the $.tablesorter.storage utility to save the most recent filters
filter_saveFilters: true
# Delay in milliseconds before the filter widget starts searching; This option prevents searching for
# every character while typing and should make searching large tables faster.
filter_searchDelay: 150
# Set this option to true to use the filter to find text from the start of the column
# So typing in "a" will find "albert" but not "frank", both have a's; default is false
filter_startsWith: false
filter_functions:
2:
"Full-time": filterSelectExactMatch
"Part-time": filterSelectExactMatch
"Contracting": filterSelectExactMatch
"Remote": filterSelectExactMatch
"Internship": filterSelectExactMatch
5:
"0-1": (e, n, f, i, $r) -> n <= 1
"2-5": (e, n, f, i, $r) -> 2 <= n <= 5
"6+": (e, n, f, i, $r) -> 6 <= n
6:
"Last day": (e, n, f, i, $r) ->
days = parseFloat $($r.find('td')[i]).data('profile-age')
days <= 1
"Last week": (e, n, f, i, $r) ->
days = parseFloat $($r.find('td')[i]).data('profile-age')
days <= 7
"Last 4 weeks": (e, n, f, i, $r) ->
days = parseFloat $($r.find('td')[i]).data('profile-age')
days <= 28
7:
"": filterSelectExactMatch
"": filterSelectExactMatch
8:
"": filterSelectExactMatch
"": filterSelectExactMatch
onCandidateClicked: (e) ->
id = $(e.target).closest('tr').data('candidate-id')

View file

@ -332,7 +332,7 @@ module.exports = class Handler
res = tv4.validateMultiple(input, @jsonSchema)
res
@isID: (id) -> _.isString(id) and id.length is 24 and id.match(/[a-z0-9]/gi)?.length is 24
@isID: (id) -> _.isString(id) and id.length is 24 and id.match(/[a-f0-9]/gi)?.length is 24
getDocumentForIdOrSlug: (idOrSlug, done) ->
idOrSlug = idOrSlug+''