mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Sort custom fields in views
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
module Util.CustomField exposing (renderValue)
|
||||
module Util.CustomField exposing (nameOrLabel, renderValue)
|
||||
|
||||
import Api.Model.ItemFieldValue exposing (ItemFieldValue)
|
||||
import Data.CustomFieldType
|
||||
@ -7,6 +7,11 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
|
||||
|
||||
nameOrLabel : ItemFieldValue -> String
|
||||
nameOrLabel fv =
|
||||
Maybe.withDefault fv.name fv.label
|
||||
|
||||
|
||||
renderValue : String -> ItemFieldValue -> Html msg
|
||||
renderValue classes cv =
|
||||
let
|
||||
@ -19,7 +24,7 @@ renderValue classes cv =
|
||||
in
|
||||
div [ class classes ]
|
||||
[ Icons.customFieldTypeIconString "" cv.ftype
|
||||
, Maybe.withDefault cv.name cv.label |> text
|
||||
, nameOrLabel cv |> text
|
||||
, div [ class "detail" ]
|
||||
[ if Data.CustomFieldType.fromString cv.ftype == Just Data.CustomFieldType.Boolean then
|
||||
renderBool
|
||||
|
Reference in New Issue
Block a user