Add three browse modes to index page: alphabetical, by tag, by course
- Add SortMode type (AlphaSort | TagSort | CourseSort) to Roux.Html - Routes: / (alpha), /sorted/tags, /sorted/course - AlphaSort: recipes sorted by title (from metadata) or filename - TagSort: recipes grouped under tag headings, empty state when none - CourseSort: recipes grouped by course/category metadata - Navigation bar in index page with active-highlighted buttons - Add metaCourse field to Metadata model (+ emptyMetadata update) - Add nubOrd helper for deduplicating tag/course lists - All 26 tests passing, hlint clean
This commit is contained in:
+7
-1
@@ -41,7 +41,13 @@ app recipeDir = do
|
||||
handleRequest :: [Idx.RecipeInfo] -> Wai.Application
|
||||
handleRequest recipes request respond =
|
||||
case Wai.pathInfo request of
|
||||
[] -> respond (htmlResponse (Html.indexPage recipes))
|
||||
-- Index page (default: alphabetical)
|
||||
[] -> respond (htmlResponse (Html.indexPage Html.AlphaSort recipes))
|
||||
-- Index page (sorted by tags)
|
||||
["sorted", "tags"] -> respond (htmlResponse (Html.indexPage Html.TagSort recipes))
|
||||
-- Index page (sorted by course/category)
|
||||
["sorted", "course"] -> respond (htmlResponse (Html.indexPage Html.CourseSort recipes))
|
||||
-- Recipe detail page
|
||||
["recipes", rawPath] ->
|
||||
case lookupRecipe (urlDecodePath rawPath) recipes of
|
||||
Just info -> respond (htmlResponse (Html.recipePage info))
|
||||
|
||||
Reference in New Issue
Block a user