Fix sortable column attributes

This commit is contained in:
Gregor Kleen 2018-04-14 20:18:24 +02:00
parent 9d65f94f51
commit acce67d562

View File

@ -161,9 +161,9 @@ dbTable PSValidator{..} DBTable{ dbtIdent = (toPathPiece -> dbtIdent), .. } = do
} }
where where
directions = [dir | (k, dir) <- psSorting, Just k == sortableKey ] directions = [dir | (k, dir) <- psSorting, Just k == sortableKey ]
sortableAttr = foldMap toAttr directions <> Html5.class_ "sortable" sortableAttr = Html5.class_ . fromString . unwords $ "sortable" : foldMap toAttr directions
toAttr SortAsc = Html5.class_ "sorted-asc" toAttr SortAsc = ["sorted-asc"]
toAttr SortDesc = Html5.class_ "sorted-desc" toAttr SortDesc = ["sorted-desc"]
$(widgetFile "table/layout") $(widgetFile "table/layout")
where where
tblLayout :: Widget -> Handler Html tblLayout :: Widget -> Handler Html