diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/departments.jade | 2 | ||||
-rw-r--r-- | views/employees.jade | 16 | ||||
-rw-r--r-- | views/employees_in_department.jade | 3 | ||||
-rw-r--r-- | views/lib/pager.jade | 12 |
4 files changed, 25 insertions, 8 deletions
diff --git a/views/departments.jade b/views/departments.jade index 14d4a31..6974763 100644 --- a/views/departments.jade +++ b/views/departments.jade @@ -12,4 +12,4 @@ block content tr td: a(href=urlgenerator.department(department.dept_no)) #{department.dept_name} - mixin pager(pager, urlgenerator.departments) + mixin pager(pager, urlgenerator.departments, query) diff --git a/views/employees.jade b/views/employees.jade index cea80ed..7a332ac 100644 --- a/views/employees.jade +++ b/views/employees.jade @@ -12,4 +12,18 @@ block content tr td: a(href=urlgenerator.employee(employee.emp_no)) #{employee.first_name} #{employee.last_name} - mixin pager(pager, urlgenerator.employees) + mixin pager(pager, urlgenerator.employees, query) + + h3 Queries + + h4 Employee Search + + form(action=urlgenerator.employees()) + table + tr + th Name + td: input(name='name') + td Searches both first and last name + tr + th + td: input(type='submit', value='Search') diff --git a/views/employees_in_department.jade b/views/employees_in_department.jade index 8313b2c..277c750 100644 --- a/views/employees_in_department.jade +++ b/views/employees_in_department.jade @@ -18,4 +18,5 @@ block content tr td: a(href=urlgenerator.employee(employee.emp_no)) #{employee.first_name} #{employee.last_name} - mixin pager(pager, function(offset) { return urlgenerator.employees_in_department(dept_no, offset) }) + - var f = function(offset) { return urlgenerator.employees_in_department(dept_no, offset) } + mixin pager(pager, f, query) diff --git a/views/lib/pager.jade b/views/lib/pager.jade index 1a47e12..3a9d451 100644 --- a/views/lib/pager.jade +++ b/views/lib/pager.jade @@ -1,9 +1,10 @@ -mixin pager(pager, f) +mixin pager(pager, f, query) p if typeof pager.prevOffset == 'number' - a(href=f(pager.prevOffset)) << Previous + - query.offset=pager.prevOffset + a(href=f(query)) << Previous else - | Previous + | << Previous | | #{pager.offset / pager.pageSize + 1} / @@ -11,7 +12,8 @@ mixin pager(pager, f) | if typeof pager.nextOffset == 'number' - a(href=f(pager.nextOffset)) Next >> + - query.offset=pager.nextOffset + a(href=f(query)) Next >> else - | Next + | Next >> |