aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/department.jade11
-rw-r--r--views/departments.jade15
-rw-r--r--views/employee.jade7
-rw-r--r--views/employees.jade15
-rw-r--r--views/employees_in_department.jade18
-rw-r--r--views/index.jade6
-rw-r--r--views/layout.jade2
-rw-r--r--views/lib/pager.jade14
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
+