aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-02 10:35:31 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-02 10:35:31 +0200
commit7d5116f6f6096a9f37c4c71635dc570b7048c992 (patch)
treee96ac4954a05660cf8e3ff70eb1d65417ab31ad7 /views
parentf895dfeb979f1a98ea38a6a88f99ff63422d4348 (diff)
downloadexample-collection-json-db-7d5116f6f6096a9f37c4c71635dc570b7048c992.tar.gz
example-collection-json-db-7d5116f6f6096a9f37c4c71635dc570b7048c992.tar.bz2
example-collection-json-db-7d5116f6f6096a9f37c4c71635dc570b7048c992.tar.xz
example-collection-json-db-7d5116f6f6096a9f37c4c71635dc570b7048c992.zip
o Adding support for employee name query.
Diffstat (limited to 'views')
-rw-r--r--views/departments.jade2
-rw-r--r--views/employees.jade16
-rw-r--r--views/employees_in_department.jade3
-rw-r--r--views/lib/pager.jade12
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)) &lt;&lt; Previous
+ - query.offset=pager.prevOffset
+ a(href=f(query)) &lt;&lt; Previous
else
- | Previous
+ | &lt;&lt; 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 &gt;&gt;
+ - query.offset=pager.nextOffset
+ a(href=f(query)) Next &gt;&gt;
else
- | Next
+ | Next &gt;&gt;