Move field contents when switching search mode in search bar

This commit is contained in:
Eike Kettner 2020-09-16 22:30:24 +02:00
parent 515bcccc57
commit aeedf58c2b

View File

@ -208,14 +208,36 @@ update mId key flags settings msg model =
let let
( sm, mv ) = ( sm, mv ) =
Comp.FixedDropdown.update lm model.searchTypeDropdown Comp.FixedDropdown.update lm model.searchTypeDropdown
m0 =
{ model
| searchTypeDropdown = sm
, searchTypeForm = Maybe.withDefault model.searchTypeForm mv
}
next =
case mv of
Just BasicSearch ->
Just
( { m0 | contentOnlySearch = Nothing }
, Maybe.withDefault "" model.contentOnlySearch
)
Just ContentOnlySearch ->
Just
( { m0 | contentOnlySearch = model.searchMenuModel.allNameModel }
, ""
)
_ ->
Nothing
in in
withSub case next of
( { model Just ( m_, nstr ) ->
| searchTypeDropdown = sm update mId key flags settings (SearchMenuMsg (Comp.SearchMenu.SetAllName nstr)) m_
, searchTypeForm = Maybe.withDefault model.searchTypeForm mv
} Nothing ->
, Cmd.none withSub ( m0, Cmd.none )
)
KeyUpMsg (Just Enter) -> KeyUpMsg (Just Enter) ->
update mId key flags settings DoSearch model update mId key flags settings DoSearch model