summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@softwarefreedom.org>2013-10-24 15:33:27 -0400
committerClint Adams <clint@softwarefreedom.org>2013-10-24 15:33:27 -0400
commit1725e252b7bd6bec9faecb0249961343bb27afb0 (patch)
treede5fe0610f2833b64fd88bb2ea40fd59129f2d27
parent45ebe1ffb0d6e229bb06a7c8dad2aabdaaf33083 (diff)
vacation report, belated commit
-rw-r--r--Application.hs1
-rw-r--r--Foundation.hs2
-rw-r--r--config/routes1
-rw-r--r--sflctimekeeper.cabal2
-rw-r--r--templates/pagenav.hamlet18
-rw-r--r--templates/userpage.hamlet3
6 files changed, 19 insertions, 8 deletions
diff --git a/Application.hs b/Application.hs
index dfd717d..a0e9257 100644
--- a/Application.hs
+++ b/Application.hs
@@ -25,6 +25,7 @@ import Handler.Home
import Handler.Category
import Handler.Employment
import Handler.User
+import Handler.Vacation
-- This line actually creates our YesodDispatch instance. It is the second half
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
diff --git a/Foundation.hs b/Foundation.hs
index 15034a1..171d414 100644
--- a/Foundation.hs
+++ b/Foundation.hs
@@ -126,6 +126,8 @@ instance Yesod App where
isAuthorized (CategoryR _) False = return Authorized
isAuthorized (EmploymentR e) True = isAdmin
isAuthorized (EmploymentR _) False = return Authorized
+ isAuthorized (VacationR u) True = isUser u -- this should be impossible
+ isAuthorized (VacationR u) False = isUserOrAdmin u
isAuthorized _ _ = return Authorized
isUser :: UserId -> GHandler s App AuthResult
diff --git a/config/routes b/config/routes
index a71d15d..ecec1de 100644
--- a/config/routes
+++ b/config/routes
@@ -8,3 +8,4 @@
/user/#UserId UserR GET POST
/category/#TimeCategoryId CategoryR GET POST
/employment/#EmploymentId EmploymentR GET POST
+/vacation/#UserId VacationR GET
diff --git a/sflctimekeeper.cabal b/sflctimekeeper.cabal
index f3dd83a..4478ed0 100644
--- a/sflctimekeeper.cabal
+++ b/sflctimekeeper.cabal
@@ -32,6 +32,7 @@ library
Handler.User
Handler.Category
Handler.Employment
+ Handler.Vacation
Auth.Proxied
PTO
@@ -89,6 +90,7 @@ library
, case-insensitive
, time
, wai
+ , transformers
executable sflctimekeeper
if flag(library-only)
diff --git a/templates/pagenav.hamlet b/templates/pagenav.hamlet
index ae38a2d..17f4ef0 100644
--- a/templates/pagenav.hamlet
+++ b/templates/pagenav.hamlet
@@ -1,10 +1,12 @@
<p>(page #{pageNumber}/#{pages}):
-$if doPrev
- <a href=@{UserR cid}?page=#{prevPageNumber}>Prev
-$else
- Prev
-$if doNext
- <a href=@{UserR cid}?page=#{nextPageNumber}>Next
-$else
- Next
+<p>
+ $if doPrev
+ <a href=@{UserR cid}?page=#{prevPageNumber}>Prev
+ $else
+ Prev
+ /
+ $if doNext
+ <a href=@{UserR cid}?page=#{nextPageNumber}>Next
+ $else
+ Next
diff --git a/templates/userpage.hamlet b/templates/userpage.hamlet
index 4205d2c..504bd22 100644
--- a/templates/userpage.hamlet
+++ b/templates/userpage.hamlet
@@ -33,3 +33,6 @@ $else
<td>#{e}
^{pageNavWidget}
+
+<p>
+ <a href=@{VacationR cid}>PTO report