Manage custom fields in webui

This commit is contained in:
Eike Kettner
2020-11-17 23:06:06 +01:00
parent 8d35d100d6
commit e90f65f941
11 changed files with 781 additions and 2 deletions

View File

@ -0,0 +1,80 @@
module Data.CustomFieldType exposing
( CustomFieldType(..)
, all
, asString
, fromString
, label
)
type CustomFieldType
= Text
| Numeric
| Date
| Boolean
| Money
all : List CustomFieldType
all =
[ Text, Numeric, Date, Boolean, Money ]
asString : CustomFieldType -> String
asString ft =
case ft of
Text ->
"text"
Numeric ->
"numeric"
Date ->
"date"
Boolean ->
"bool"
Money ->
"money"
label : CustomFieldType -> String
label ft =
case ft of
Text ->
"Text"
Numeric ->
"Numeric"
Date ->
"Date"
Boolean ->
"Boolean"
Money ->
"Money"
fromString : String -> Maybe CustomFieldType
fromString str =
case String.toLower str of
"text" ->
Just Text
"numeric" ->
Just Numeric
"date" ->
Just Date
"bool" ->
Just Boolean
"money" ->
Just Money
_ ->
Nothing

View File

@ -20,6 +20,7 @@ type Field
| DueDate
| Direction
| PreviewImage
| CustomFields
all : List Field
@ -35,6 +36,7 @@ all =
, DueDate
, Direction
, PreviewImage
, CustomFields
]
@ -76,6 +78,9 @@ fromString str =
"preview" ->
Just PreviewImage
"customfields" ->
Just CustomFields
_ ->
Nothing
@ -113,6 +118,9 @@ toString field =
PreviewImage ->
"preview"
CustomFields ->
"customfields"
label : Field -> String
label field =
@ -147,6 +155,9 @@ label field =
PreviewImage ->
"Preview Image"
CustomFields ->
"Custom Fields"
fromList : List String -> List Field
fromList strings =

View File

@ -5,6 +5,8 @@ module Data.Icons exposing
, concernedIcon
, correspondent
, correspondentIcon
, customField
, customFieldIcon
, date
, dateIcon
, direction
@ -33,6 +35,16 @@ import Html exposing (Html, i)
import Html.Attributes exposing (class)
customField : String
customField =
"highlighter icon"
customFieldIcon : String -> Html msg
customFieldIcon classes =
i [ class (customField ++ " " ++ classes) ] []
search : String
search =
"search icon"