mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 09:58:26 +00:00
Define how many tags to see in ui settings
This commit is contained in:
@ -32,6 +32,10 @@ type alias Model =
|
||||
, itemDetailNotesPosition : Pos
|
||||
, searchMenuFolderCount : Maybe Int
|
||||
, searchMenuFolderCountModel : Comp.IntField.Model
|
||||
, searchMenuTagCount : Maybe Int
|
||||
, searchMenuTagCountModel : Comp.IntField.Model
|
||||
, searchMenuTagCatCount : Maybe Int
|
||||
, searchMenuTagCatCountModel : Comp.IntField.Model
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +69,20 @@ init flags settings =
|
||||
(Just 2000)
|
||||
False
|
||||
"Number of folders in search menu"
|
||||
, searchMenuTagCount = Just settings.searchMenuTagCount
|
||||
, searchMenuTagCountModel =
|
||||
Comp.IntField.init
|
||||
(Just 0)
|
||||
(Just 2000)
|
||||
False
|
||||
"Number of tags in search menu"
|
||||
, searchMenuTagCatCount = Just settings.searchMenuTagCatCount
|
||||
, searchMenuTagCatCountModel =
|
||||
Comp.IntField.init
|
||||
(Just 0)
|
||||
(Just 2000)
|
||||
False
|
||||
"Number of categories in search menu"
|
||||
}
|
||||
, Api.getTags flags "" GetTagsResp
|
||||
)
|
||||
@ -78,6 +96,8 @@ type Msg
|
||||
| NoteLengthMsg Comp.IntField.Msg
|
||||
| SetNotesPosition Pos
|
||||
| SearchMenuFolderMsg Comp.IntField.Msg
|
||||
| SearchMenuTagMsg Comp.IntField.Msg
|
||||
| SearchMenuTagCatMsg Comp.IntField.Msg
|
||||
|
||||
|
||||
|
||||
@ -135,6 +155,38 @@ update sett msg model =
|
||||
in
|
||||
( model_, nextSettings )
|
||||
|
||||
SearchMenuTagMsg lm ->
|
||||
let
|
||||
( m, n ) =
|
||||
Comp.IntField.update lm model.searchMenuTagCountModel
|
||||
|
||||
nextSettings =
|
||||
Maybe.map (\len -> { sett | searchMenuTagCount = len }) n
|
||||
|
||||
model_ =
|
||||
{ model
|
||||
| searchMenuTagCountModel = m
|
||||
, searchMenuTagCount = n
|
||||
}
|
||||
in
|
||||
( model_, nextSettings )
|
||||
|
||||
SearchMenuTagCatMsg lm ->
|
||||
let
|
||||
( m, n ) =
|
||||
Comp.IntField.update lm model.searchMenuTagCatCountModel
|
||||
|
||||
nextSettings =
|
||||
Maybe.map (\len -> { sett | searchMenuTagCatCount = len }) n
|
||||
|
||||
model_ =
|
||||
{ model
|
||||
| searchMenuTagCatCountModel = m
|
||||
, searchMenuTagCatCount = n
|
||||
}
|
||||
in
|
||||
( model_, nextSettings )
|
||||
|
||||
SetNotesPosition pos ->
|
||||
let
|
||||
model_ =
|
||||
@ -232,9 +284,23 @@ view flags _ model =
|
||||
)
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Search Menu" ]
|
||||
, Html.map SearchMenuTagMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many tags to display in search menu at once. Others can be expanded. Use 0 to always show all."
|
||||
model.searchMenuTagCount
|
||||
"field"
|
||||
model.searchMenuTagCountModel
|
||||
)
|
||||
, Html.map SearchMenuTagCatMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many categories to display in search menu at once. Others can be expanded. Use 0 to always show all."
|
||||
model.searchMenuTagCatCount
|
||||
"field"
|
||||
model.searchMenuTagCatCountModel
|
||||
)
|
||||
, Html.map SearchMenuFolderMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many folders to display in search menu at once. Other folders can be expanded."
|
||||
"How many folders to display in search menu at once. Other folders can be expanded. Use 0 to always show all."
|
||||
model.searchMenuFolderCount
|
||||
"field"
|
||||
model.searchMenuFolderCountModel
|
||||
|
Reference in New Issue
Block a user