Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed unnecessary parameter from some of the path functions

  • Loading branch information...
commit 7624529b9f5f99a6fa830bbf560dd2a1755e661c 1 parent 50458bb
@mightybyte mightybyte authored
Showing with 23 additions and 22 deletions.
  1. +3 −3 restful-snap.cabal
  2. +20 −19 src/Snap/Restful.hs
View
6 restful-snap.cabal
@@ -22,9 +22,9 @@ library
build-depends:
base == 4.5.*
+ , bytestring
+ , data-default
+ , heist
, snap-core
, snap
- , heist
- , bytestring
, text
- , data-default
View
39 src/Snap/Restful.hs
@@ -170,6 +170,21 @@ itemActionPath Resource{..} t DBId{..} = T.intercalate "/" [rRoot, showT unDBId,
-------------------------------------------------------------------------------
+indexPath :: Resource b v a -> Text
+indexPath r = rRoot r
+
+
+-------------------------------------------------------------------------------
+createPath :: Resource b v a -> Text
+createPath r = rRoot r
+
+
+-------------------------------------------------------------------------------
+rootPath :: Resource b v a -> Text
+rootPath = indexPath
+
+
+-------------------------------------------------------------------------------
editPath :: Resource b v a -> DBId -> Text
editPath r dbid = crudPath r REdit dbid
@@ -190,33 +205,19 @@ destroyPath r dbid = crudPath r RDestroy dbid
-------------------------------------------------------------------------------
-indexPath :: Resource b v a -> DBId -> Text
-indexPath r dbid = crudPath r RIndex dbid
-
-
--------------------------------------------------------------------------------
-createPath :: Resource b v a -> DBId -> Text
-createPath r dbid = crudPath r RCreate dbid
-
-
--------------------------------------------------------------------------------
newPath :: Resource b v a -> DBId -> Text
newPath r dbid = crudPath r RNew dbid
--------------------------------------------------------------------------------
-rootPath :: Resource b v a -> DBId -> Text
-rootPath = indexPath
-
-------------------------------------------------------------------------------
resourceSplices :: Resource b v a -> [(Text, SnapletSplice b v)]
resourceSplices r@Resource{..} =
[ (T.concat [rName, "NewPath"], liftHeist . textSplice $ newPath r def)
- , (T.concat [rName, "IndexPath"], liftHeist . textSplice $ indexPath r def)
- , (T.concat [rName, "CreatePath"], liftHeist . textSplice $ createPath r def)
- , (T.concat [rName, "Path"], liftHeist . textSplice $ rootPath r def)
+ , (T.concat [rName, "IndexPath"], liftHeist . textSplice $ indexPath r)
+ , (T.concat [rName, "CreatePath"], liftHeist . textSplice $ createPath r)
+ , (T.concat [rName, "Path"], liftHeist . textSplice $ rootPath r)
]
@@ -229,8 +230,8 @@ itemSplices r@Resource{..} dbid =
, (T.concat [rName, "ItemUpdatePath"], textSplice $ updatePath r dbid)
, (T.concat [rName, "ItemDestroyPath"], textSplice $ destroyPath r dbid)
, (T.concat [rName, "ItemNewPath"], textSplice $ newPath r dbid)
- , (T.concat [rName, "ItemIndexPath"], textSplice $ indexPath r dbid)
- , (T.concat [rName, "ItemCreatePath"], textSplice $ createPath r dbid)
+ , (T.concat [rName, "ItemIndexPath"], textSplice $ indexPath r)
+ , (T.concat [rName, "ItemCreatePath"], textSplice $ createPath r)
]
Please sign in to comment.
Something went wrong with that request. Please try again.