mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-25 16:45:05 +00:00
Set search when clicking on parts of the item card
When user clicks on correspondent etc. on an item card, the search is set to this value.
This commit is contained in:
parent
faf97222ea
commit
795cd8bc80
@ -6,6 +6,7 @@ import Api.Model.ItemLightList exposing (ItemLightList)
|
|||||||
import Api.Model.ItemSearch
|
import Api.Model.ItemSearch
|
||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
import Comp.FixedDropdown
|
import Comp.FixedDropdown
|
||||||
|
import Comp.ItemCard
|
||||||
import Comp.ItemCardList
|
import Comp.ItemCardList
|
||||||
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
||||||
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
||||||
@ -93,6 +94,26 @@ update mId key flags settings msg model =
|
|||||||
m
|
m
|
||||||
model.itemListModel
|
model.itemListModel
|
||||||
|
|
||||||
|
searchMsg =
|
||||||
|
case result.linkTarget of
|
||||||
|
Comp.ItemCard.LinkNone ->
|
||||||
|
Cmd.none
|
||||||
|
|
||||||
|
Comp.ItemCard.LinkCorrOrg id ->
|
||||||
|
Util.Update.cmdUnit (SearchMenuMsg (Comp.SearchMenu.SetCorrOrg id))
|
||||||
|
|
||||||
|
Comp.ItemCard.LinkCorrPerson id ->
|
||||||
|
Util.Update.cmdUnit (SearchMenuMsg (Comp.SearchMenu.SetCorrPerson id))
|
||||||
|
|
||||||
|
Comp.ItemCard.LinkConcPerson id ->
|
||||||
|
Util.Update.cmdUnit (SearchMenuMsg (Comp.SearchMenu.SetConcPerson id))
|
||||||
|
|
||||||
|
Comp.ItemCard.LinkConcEquip id ->
|
||||||
|
Util.Update.cmdUnit (SearchMenuMsg (Comp.SearchMenu.SetConcEquip id))
|
||||||
|
|
||||||
|
Comp.ItemCard.LinkFolder id ->
|
||||||
|
Util.Update.cmdUnit (SearchMenuMsg (Comp.SearchMenu.SetFolder id))
|
||||||
|
|
||||||
nextView =
|
nextView =
|
||||||
case ( model.viewMode, result.selection ) of
|
case ( model.viewMode, result.selection ) of
|
||||||
( SelectView svm, Data.ItemSelection.Active ids ) ->
|
( SelectView svm, Data.ItemSelection.Active ids ) ->
|
||||||
@ -107,7 +128,7 @@ update mId key flags settings msg model =
|
|||||||
, viewMode = nextView
|
, viewMode = nextView
|
||||||
, dragDropData = DD.DragDropData result.dragModel Nothing
|
, dragDropData = DD.DragDropData result.dragModel Nothing
|
||||||
}
|
}
|
||||||
, Cmd.batch [ Cmd.map ItemCardListMsg result.cmd ]
|
, Cmd.batch [ Cmd.map ItemCardListMsg result.cmd, searchMsg ]
|
||||||
)
|
)
|
||||||
|
|
||||||
ItemSearchResp scroll (Ok list) ->
|
ItemSearchResp scroll (Ok list) ->
|
||||||
|
@ -300,7 +300,11 @@ viewSearchBar flags model =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
[ a
|
[ a
|
||||||
[ class "search-menu-toggle ui blue icon button"
|
[ classList
|
||||||
|
[ ( "search-menu-toggle ui icon button", True )
|
||||||
|
, ( "primary", not (searchMenuFilled model) )
|
||||||
|
, ( "secondary", searchMenuFilled model )
|
||||||
|
]
|
||||||
, onClick ToggleSearchMenu
|
, onClick ToggleSearchMenu
|
||||||
, href "#"
|
, href "#"
|
||||||
, title "Open search menu"
|
, title "Open search menu"
|
||||||
@ -345,6 +349,15 @@ viewSearchBar flags model =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
searchMenuFilled : Model -> Bool
|
||||||
|
searchMenuFilled model =
|
||||||
|
let
|
||||||
|
is =
|
||||||
|
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
||||||
|
in
|
||||||
|
is /= Api.Model.ItemSearch.empty
|
||||||
|
|
||||||
|
|
||||||
hasMoreSearch : Model -> Bool
|
hasMoreSearch : Model -> Bool
|
||||||
hasMoreSearch model =
|
hasMoreSearch model =
|
||||||
let
|
let
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
module Util.Update exposing (andThen1, andThen2)
|
module Util.Update exposing
|
||||||
|
( andThen1
|
||||||
|
, andThen2
|
||||||
|
, cmdUnit
|
||||||
|
)
|
||||||
|
|
||||||
|
import Task
|
||||||
|
|
||||||
|
|
||||||
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
|
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
|
||||||
@ -36,3 +42,8 @@ andThen2 fs m =
|
|||||||
in
|
in
|
||||||
List.foldl update init fs
|
List.foldl update init fs
|
||||||
|> combine
|
|> combine
|
||||||
|
|
||||||
|
|
||||||
|
cmdUnit : a -> Cmd a
|
||||||
|
cmdUnit a =
|
||||||
|
Task.perform (\_ -> a) (Task.succeed ())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user