diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-01 03:26:26 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-01 03:26:26 +0200 |
commit | c66f8be25f230f8fcea2774e54a56ad43fba9b58 (patch) | |
tree | d20130f43292ff0322afcc71b9fcbf41e076fd93 /views | |
parent | 02588ca7aa174c5b4c95c8f124eb8086042f9538 (diff) | |
download | example-collection-json-db-c66f8be25f230f8fcea2774e54a56ad43fba9b58.tar.gz example-collection-json-db-c66f8be25f230f8fcea2774e54a56ad43fba9b58.tar.bz2 example-collection-json-db-c66f8be25f230f8fcea2774e54a56ad43fba9b58.tar.xz example-collection-json-db-c66f8be25f230f8fcea2774e54a56ad43fba9b58.zip |
o Adding paging.
o Adding new root resource.
Diffstat (limited to 'views')
-rw-r--r-- | views/department.jade | 11 | ||||
-rw-r--r-- | views/departments.jade | 15 | ||||
-rw-r--r-- | views/employee.jade | 7 | ||||
-rw-r--r-- | views/employees.jade | 15 | ||||
-rw-r--r-- | views/employees_in_department.jade | 18 | ||||
-rw-r--r-- | views/index.jade | 6 | ||||
-rw-r--r-- | views/layout.jade | 2 | ||||
-rw-r--r-- | views/lib/pager.jade | 14 |
8 files changed, 73 insertions, 15 deletions
diff --git a/views/department.jade b/views/department.jade index e2a5bde..32952a9 100644 --- a/views/department.jade +++ b/views/department.jade @@ -3,6 +3,13 @@ extends layout block content h1= title - p: a(href=urlgenerator.departments()) All departments + p + a(href=urlgenerator.start()) Employee DB + | >> + a(href=urlgenerator.departments()) Department List + | >> + a(href=urlgenerator.department(dept_no)) Department ##{dept_no} - p: a(href=urlgenerator.employees_in_department(dept_no)) Employees + p: a(href=urlgenerator.employees_in_department(dept_no)) Employees in this department + + p TODO: add links to manager and department name. diff --git a/views/departments.jade b/views/departments.jade index 711e0ec..bdcb0ae 100644 --- a/views/departments.jade +++ b/views/departments.jade @@ -1,8 +1,15 @@ extends layout +include lib/pager block content - h1= title - each department in departments - table + p + a(href=urlgenerator.start()) Employee DB + | >> + a(href=urlgenerator.departments()) Department List + + table + each department in departments tr - td: a(href='/department/#{department.dept_no}') #{department.dept_name} + td: a(href=urlgenerator.department(department.dept_no)) #{department.dept_name} + + mixin pager(pager, departments.length, urlgenerator.departments) diff --git a/views/employee.jade b/views/employee.jade index 6cd2c10..6728540 100644 --- a/views/employee.jade +++ b/views/employee.jade @@ -1,7 +1,12 @@ extends layout block content - h1= title + p + a(href=urlgenerator.start()) Employee DB + | >> + a(href=urlgenerator.employees()) Employee List + | >> + a(href=urlgenerator.employee(employee.emp_no)) Employee ##{employee.emp_no} table tr diff --git a/views/employees.jade b/views/employees.jade new file mode 100644 index 0000000..d7d9005 --- /dev/null +++ b/views/employees.jade @@ -0,0 +1,15 @@ +extends layout +include lib/pager + +block content + p + a(href=urlgenerator.start()) Employee DB + | >> + a(href=urlgenerator.employees()) Employee List + + table + each employee in employees + tr + td: a(href=urlgenerator.employee(employee.emp_no)) #{employee.first_name} #{employee.last_name} + + mixin pager(pager, employees.length, urlgenerator.employees) diff --git a/views/employees_in_department.jade b/views/employees_in_department.jade index f835a29..c341647 100644 --- a/views/employees_in_department.jade +++ b/views/employees_in_department.jade @@ -1,13 +1,21 @@ extends layout +include lib/pager block content h1= title - p: a(href=urlgenerator.department(dept_no)) Department #{dept_no} + p + a(href=urlgenerator.start()) Employee DB + | >> + a(href=urlgenerator.departments()) Department List + | >> + a(href=urlgenerator.department(dept_no)) Department ##{dept_no} + | >> + a(href=urlgenerator.employees_in_department(dept_no)) Employees in Department ##{dept_no} - p This department has #{employees.length} employees. - - each employee in employees - table + table + each employee in employees tr td: a(href=urlgenerator.employee(employee.emp_no)) #{employee.first_name} #{employee.last_name} + + mixin pager(pager, employees.length, function(offset) { return urlgenerator.employees_in_department(dept_no, offset) }) diff --git a/views/index.jade b/views/index.jade index ef7b09f..f195915 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,5 +1,7 @@ extends layout block content - h1= title - p Welcome to #{title}
\ No newline at end of file + p Available resources + ul + li: a(href=urlgenerator.departments()) Departments list + li: a(href=urlgenerator.employees()) Employees list diff --git a/views/layout.jade b/views/layout.jade index 1b7b305..367640e 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -4,4 +4,4 @@ html title= title link(rel='stylesheet', href='/stylesheets/style.css') body - block content
\ No newline at end of file + block content diff --git a/views/lib/pager.jade b/views/lib/pager.jade new file mode 100644 index 0000000..a762735 --- /dev/null +++ b/views/lib/pager.jade @@ -0,0 +1,14 @@ +mixin pager(pager, length, f) + p + if pager.offset > 0 + a(href=f(pager.prevOffset)) prev + | + else + | prev + + - var nextOffset = pager.nextOffset(length) + if nextOffset > 0 + a(href=f(nextOffset)) next + else + | next + |