Display item notes in card view if configured

The user can set a maximum length of the item notes to display in each
card. If set to 0, it is hidden.
This commit is contained in:
Eike Kettner
2020-08-04 23:34:08 +02:00
parent 09d74b7e80
commit 08f953dd52
9 changed files with 99 additions and 17 deletions

View File

@ -1,6 +1,8 @@
module Util.String exposing
( crazyEncode
, ellipsis
, isBlank
, isNothingOrBlank
, underscoreToSpace
, withDefault
)
@ -31,7 +33,7 @@ ellipsis len str =
str
else
String.left (len - 3) str ++ "..."
String.left (len - 1) str ++ ""
withDefault : String -> String -> String
@ -46,3 +48,14 @@ withDefault default str =
underscoreToSpace : String -> String
underscoreToSpace str =
String.replace "_" " " str
isBlank : String -> Bool
isBlank s =
s == "" || (String.trim s == "")
isNothingOrBlank : Maybe String -> Bool
isNothingOrBlank ms =
Maybe.map isBlank ms
|> Maybe.withDefault True