mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Display custom field values on item card
This commit is contained in:
30
modules/webapp/src/main/elm/Util/CustomField.elm
Normal file
30
modules/webapp/src/main/elm/Util/CustomField.elm
Normal file
@ -0,0 +1,30 @@
|
||||
module Util.CustomField exposing (renderValue)
|
||||
|
||||
import Api.Model.ItemFieldValue exposing (ItemFieldValue)
|
||||
import Data.CustomFieldType
|
||||
import Data.Icons as Icons
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
|
||||
|
||||
renderValue : String -> ItemFieldValue -> Html msg
|
||||
renderValue classes cv =
|
||||
let
|
||||
renderBool =
|
||||
if cv.value == "true" then
|
||||
i [ class "check icon" ] []
|
||||
|
||||
else
|
||||
i [ class "minus icon" ] []
|
||||
in
|
||||
div [ class classes ]
|
||||
[ Icons.customFieldTypeIconString "" cv.ftype
|
||||
, Maybe.withDefault cv.name cv.label |> text
|
||||
, div [ class "detail" ]
|
||||
[ if Data.CustomFieldType.fromString cv.ftype == Just Data.CustomFieldType.Boolean then
|
||||
renderBool
|
||||
|
||||
else
|
||||
text cv.value
|
||||
]
|
||||
]
|
Reference in New Issue
Block a user