Fix bug in dropdown

The menu for a multi-dropdown should only show entries that are not
already selected (there is no use case to select the same item more
than once).
This commit is contained in:
Eike Kettner 2020-06-12 23:12:49 +02:00
parent 152ad7373c
commit d41ddd9729
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,9 @@ module Comp.Dropdown exposing
, view , view
) )
{-| This needs to be rewritten from scratch!
-}
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
@ -41,7 +44,8 @@ makeItem model val =
{ value = val { value = val
, option = model.makeOption val , option = model.makeOption val
, visible = True , visible = True
, selected = False , selected =
List.any (\i -> i.value == val) model.selected
, active = False , active = False
} }

View File

@ -276,6 +276,7 @@ saveTags flags model =
let let
tags = tags =
Comp.Dropdown.getSelected model.tagModel Comp.Dropdown.getSelected model.tagModel
|> Util.List.distinct
|> List.map (\t -> IdName t.id t.name) |> List.map (\t -> IdName t.id t.name)
|> ReferenceList |> ReferenceList
in in