From e021f06946b5d27b977c2490b3dfa6f32e1ce20d Mon Sep 17 00:00:00 2001 From: eikek Date: Mon, 14 Jun 2021 21:02:36 +0200 Subject: [PATCH] Update language dropdown for new data When receiving a new value to display in the form, the language dropdown was not initialized with the corresponding value. --- modules/webapp/src/main/elm/Comp/SourceForm.elm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/webapp/src/main/elm/Comp/SourceForm.elm b/modules/webapp/src/main/elm/Comp/SourceForm.elm index 6c4b7a5b..4a94ae3b 100644 --- a/modules/webapp/src/main/elm/Comp/SourceForm.elm +++ b/modules/webapp/src/main/elm/Comp/SourceForm.elm @@ -155,6 +155,7 @@ update flags msg model = , enabled = t.source.enabled , folder = t.source.folder , fileFilter = t.source.fileFilter + , language = t.source.language } newModel = @@ -168,6 +169,7 @@ update flags msg model = , enabled = t.source.enabled , folderId = t.source.folder , fileFilter = t.source.fileFilter + , language = t.source.language } mkIdName id = @@ -189,12 +191,21 @@ update flags msg model = Nothing -> [] + langSel = + case Maybe.andThen Data.Language.fromString t.source.language of + Just lang -> + [ lang ] + + Nothing -> + [] + tags = Comp.Dropdown.SetSelection t.tags.items in Util.Update.andThen1 [ update flags (FolderDropdownMsg (Comp.Dropdown.SetSelection sel)) , update flags (TagDropdownMsg tags) + , update flags (LanguageMsg (Comp.Dropdown.SetSelection langSel)) ] newModel