-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Simmerl
committed
Dec 2, 2016
1 parent
9adf121
commit a616f49
Showing
4 changed files
with
129 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Route exposing (..) | ||
|
||
import Navigation exposing (Location) | ||
import UrlParser exposing (Parser, (</>), map, oneOf, parsePath, top, s, string) | ||
|
||
type Route | ||
= App String | ||
| Apps | ||
| Home | ||
|
||
construct : Route -> String | ||
construct route = | ||
case route of | ||
App id -> | ||
"/apps/" ++ id | ||
Apps -> | ||
"/apps" | ||
Home -> | ||
"/" | ||
|
||
routes : Parser (Route -> a) a | ||
routes = | ||
oneOf | ||
[ map Home top | ||
, map App (s "apps" </> string) | ||
, map Apps (s "apps") | ||
] | ||
|
||
parse : Location -> (Maybe Route) | ||
parse location = | ||
parsePath routes location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters