Allow to choose from existing tag categories

Also fixes a ui problem with a too long dropdown menu in the small
modal popup when adding tags or custom fields in item detail view.

Issue: #331
This commit is contained in:
Eike Kettner
2020-11-26 22:48:10 +01:00
parent 5a7d39add6
commit c87163052b
7 changed files with 103 additions and 24 deletions

View File

@ -98,6 +98,7 @@ type alias Model =
, customFieldsModel : Comp.CustomFieldMultiInput.Model
, customFieldSavingIcon : Dict String String
, customFieldThrottle : Throttle Msg
, allTags : List Tag
}
@ -202,6 +203,7 @@ emptyModel =
, customFieldsModel = Comp.CustomFieldMultiInput.initWith []
, customFieldSavingIcon = Dict.empty
, customFieldThrottle = Throttle.create 1
, allTags = []
}

View File

@ -65,6 +65,7 @@ import Util.Http
import Util.List
import Util.Maybe
import Util.String
import Util.Tag
update : Nav.Key -> Flags -> ItemNav -> UiSettings -> Msg -> Model -> UpdateResult
@ -588,7 +589,7 @@ update key flags inav settings msg model =
tagList =
Comp.Dropdown.SetOptions tags.items
in
update key flags inav settings (TagDropdownMsg tagList) model
update key flags inav settings (TagDropdownMsg tagList) { model | allTags = tags.items }
GetTagsResp (Err _) ->
resultModel model
@ -1039,9 +1040,13 @@ update key flags inav settings msg model =
resultModel model
StartTagModal ->
let
cats =
Util.Tag.getCategories model.allTags
in
resultModel
{ model
| modalEdit = Just (Comp.DetailEdit.initTagByName model.item.id "")
| modalEdit = Just (Comp.DetailEdit.initTagByName model.item.id "" cats)
}
StartCorrOrgModal ->