mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-05 22:55:58 +00:00
Add search field for 'all-names' to search menu
This commit is contained in:
parent
f30c8a5e4d
commit
5468e24b55
@ -54,6 +54,7 @@ type alias Model =
|
||||
, untilDueDateModel : DatePicker
|
||||
, untilDueDate : Maybe Int
|
||||
, nameModel : Maybe String
|
||||
, allNameModel : Maybe String
|
||||
, datePickerInitialized : Bool
|
||||
}
|
||||
|
||||
@ -109,6 +110,7 @@ init =
|
||||
, untilDueDateModel = Comp.DatePicker.emptyModel
|
||||
, untilDueDate = Nothing
|
||||
, nameModel = Nothing
|
||||
, allNameModel = Nothing
|
||||
, datePickerInitialized = False
|
||||
}
|
||||
|
||||
@ -132,6 +134,7 @@ type Msg
|
||||
| GetEquipResp (Result Http.Error EquipmentList)
|
||||
| GetPersonResp (Result Http.Error ReferenceList)
|
||||
| SetName String
|
||||
| SetAllName String
|
||||
| ResetForm
|
||||
|
||||
|
||||
@ -182,6 +185,9 @@ getItemSearch model =
|
||||
, name =
|
||||
model.nameModel
|
||||
|> Maybe.map amendWildcards
|
||||
, allNames =
|
||||
model.allNameModel
|
||||
|> Maybe.map amendWildcards
|
||||
}
|
||||
|
||||
|
||||
@ -467,6 +473,17 @@ update flags settings msg model =
|
||||
)
|
||||
(model.nameModel /= next)
|
||||
|
||||
SetAllName str ->
|
||||
let
|
||||
next =
|
||||
Util.Maybe.fromString str
|
||||
in
|
||||
NextState
|
||||
( { model | allNameModel = next }
|
||||
, Cmd.none
|
||||
)
|
||||
(model.allNameModel /= next)
|
||||
|
||||
|
||||
|
||||
-- View
|
||||
@ -497,6 +514,19 @@ view settings model =
|
||||
]
|
||||
]
|
||||
]
|
||||
, formHeader (i [ class "left align icon" ] []) "By Name"
|
||||
, div [ class "field" ]
|
||||
[ label [] [ text "All Names" ]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetAllName
|
||||
, model.allNameModel |> Maybe.withDefault "" |> value
|
||||
]
|
||||
[]
|
||||
, span [ class "small-info" ]
|
||||
[ text "Looks in correspondents, concerned, item name and notes."
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ label [] [ text "Name or Notes" ]
|
||||
, input
|
||||
@ -505,13 +535,16 @@ view settings model =
|
||||
, model.nameModel |> Maybe.withDefault "" |> value
|
||||
]
|
||||
[]
|
||||
, span [ class "small-info" ]
|
||||
[ text "Looks in item name and notes only."
|
||||
]
|
||||
]
|
||||
, span [ class "small-info" ]
|
||||
[ text "Use wildcards "
|
||||
, code [] [ text "*" ]
|
||||
, text " at beginning or end. Added automatically if not "
|
||||
, text "present and not quoted."
|
||||
]
|
||||
]
|
||||
, formHeader (Icons.tagsIcon "") "Tags"
|
||||
, div [ class "field" ]
|
||||
[ label [] [ text "Include (and)" ]
|
||||
|
@ -35,7 +35,7 @@ update key flags settings msg model =
|
||||
{ model | searchMenuModel = Tuple.first nextState.modelCmd }
|
||||
|
||||
( m2, c2 ) =
|
||||
if nextState.stateChange then
|
||||
if nextState.stateChange && not model.searchInProgress then
|
||||
doSearch flags settings newModel
|
||||
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user