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

@ -16,6 +16,8 @@ type alias Config =
, docspellAssetPath : String
, integrationEnabled : Bool
, fullTextSearchEnabled : Bool
, maxPageSize : Int
, maxNoteLength : Int
}

View File

@ -26,6 +26,7 @@ type alias StoredUiSettings =
{ itemSearchPageSize : Maybe Int
, tagCategoryColors : List ( String, String )
, nativePdfPreview : Bool
, itemSearchNoteLength : Maybe Int
}
@ -40,6 +41,7 @@ type alias UiSettings =
{ itemSearchPageSize : Int
, tagCategoryColors : Dict String Color
, nativePdfPreview : Bool
, itemSearchNoteLength : Int
}
@ -48,6 +50,7 @@ defaults =
{ itemSearchPageSize = 60
, tagCategoryColors = Dict.empty
, nativePdfPreview = False
, itemSearchNoteLength = 0
}
@ -64,6 +67,8 @@ merge given fallback =
)
fallback.tagCategoryColors
, nativePdfPreview = given.nativePdfPreview
, itemSearchNoteLength =
choose given.itemSearchNoteLength fallback.itemSearchNoteLength
}
@ -79,6 +84,7 @@ toStoredUiSettings settings =
Dict.map (\_ -> Data.Color.toString) settings.tagCategoryColors
|> Dict.toList
, nativePdfPreview = settings.nativePdfPreview
, itemSearchNoteLength = Just settings.itemSearchNoteLength
}