diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-06-06 15:31:16 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-06-06 15:31:16 +0200 |
commit | 612da78d17c575cd5ade1de62dc1a3c514129de0 (patch) | |
tree | edf00a2d0c55d869a1a717138c4b7ef6c290ef61 /frontend/app/Schema.hs | |
parent | a569f8d7a2da3b2769a3bbf3414c164043321dd7 (diff) |
link to edit page from list page
Diffstat (limited to 'frontend/app/Schema.hs')
-rw-r--r-- | frontend/app/Schema.hs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/frontend/app/Schema.hs b/frontend/app/Schema.hs index ee958d8..0530061 100644 --- a/frontend/app/Schema.hs +++ b/frontend/app/Schema.hs @@ -19,6 +19,7 @@ import Data.Text qualified as T import Form qualified as F import Miso import Miso.String (toMisoString) +import Route data Schema = Schema { id :: String, @@ -66,8 +67,8 @@ viewSchema schema = ) <$> (M.toList properties) -schemaTable :: Schema -> [A.Value] -> View action -schemaTable schema values = +schemaTable :: String -> Schema -> [A.Value] -> View action +schemaTable collection schema values = table_ [] [thead, tbody] where thead = @@ -85,10 +86,19 @@ schemaTable schema values = [ tr_ [] [ td_ [] $ - [ text $ - case getO (AK.fromString k) value of - A.String s -> toMisoString s - value -> toMisoString (A.encode value) + [ case (k, getO (AK.fromString k) value) of + ("$fileName", A.String fn) -> + a_ + [ href_ + (toMisoString (routeToString (EditValue collection (T.unpack fn)))) + ] + [ text (toMisoString fn) + ] + (_, v) -> + text $ + case v of + A.String s -> toMisoString s + _ -> toMisoString (A.encode v) ] | k <- M.keys properties ] |