mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Search by tag category via web ui
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
module Util.Tag exposing (makeDropdownModel)
|
||||
module Util.Tag exposing
|
||||
( getCategories
|
||||
, makeCatDropdownModel
|
||||
, makeDropdownModel
|
||||
)
|
||||
|
||||
import Api.Model.Tag exposing (Tag)
|
||||
import Comp.Dropdown
|
||||
import Data.UiSettings
|
||||
import Util.List
|
||||
|
||||
|
||||
makeDropdownModel : Comp.Dropdown.Model Tag
|
||||
@ -17,3 +22,20 @@ makeDropdownModel =
|
||||
"basic " ++ Data.UiSettings.tagColorString tag settings
|
||||
, placeholder = "Choose a tag…"
|
||||
}
|
||||
|
||||
|
||||
makeCatDropdownModel : Comp.Dropdown.Model String
|
||||
makeCatDropdownModel =
|
||||
Comp.Dropdown.makeModel
|
||||
{ multiple = True
|
||||
, searchable = \n -> n > 5
|
||||
, makeOption = \cat -> { value = cat, text = cat, additional = "" }
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, placeholder = "Choose a tag category…"
|
||||
}
|
||||
|
||||
|
||||
getCategories : List Tag -> List String
|
||||
getCategories tags =
|
||||
List.filterMap .category tags
|
||||
|> Util.List.distinct
|
||||
|
Reference in New Issue
Block a user