Sort custom fields in views

This commit is contained in:
Eike Kettner
2021-01-02 10:09:05 +01:00
parent 70983f115c
commit ae57881f2d
4 changed files with 101 additions and 71 deletions

View File

@ -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