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
|
, untilDueDateModel : DatePicker
|
||||||
, untilDueDate : Maybe Int
|
, untilDueDate : Maybe Int
|
||||||
, nameModel : Maybe String
|
, nameModel : Maybe String
|
||||||
|
, allNameModel : Maybe String
|
||||||
, datePickerInitialized : Bool
|
, datePickerInitialized : Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +110,7 @@ init =
|
|||||||
, untilDueDateModel = Comp.DatePicker.emptyModel
|
, untilDueDateModel = Comp.DatePicker.emptyModel
|
||||||
, untilDueDate = Nothing
|
, untilDueDate = Nothing
|
||||||
, nameModel = Nothing
|
, nameModel = Nothing
|
||||||
|
, allNameModel = Nothing
|
||||||
, datePickerInitialized = False
|
, datePickerInitialized = False
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +134,7 @@ type Msg
|
|||||||
| GetEquipResp (Result Http.Error EquipmentList)
|
| GetEquipResp (Result Http.Error EquipmentList)
|
||||||
| GetPersonResp (Result Http.Error ReferenceList)
|
| GetPersonResp (Result Http.Error ReferenceList)
|
||||||
| SetName String
|
| SetName String
|
||||||
|
| SetAllName String
|
||||||
| ResetForm
|
| ResetForm
|
||||||
|
|
||||||
|
|
||||||
@ -182,6 +185,9 @@ getItemSearch model =
|
|||||||
, name =
|
, name =
|
||||||
model.nameModel
|
model.nameModel
|
||||||
|> Maybe.map amendWildcards
|
|> Maybe.map amendWildcards
|
||||||
|
, allNames =
|
||||||
|
model.allNameModel
|
||||||
|
|> Maybe.map amendWildcards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -467,6 +473,17 @@ update flags settings msg model =
|
|||||||
)
|
)
|
||||||
(model.nameModel /= next)
|
(model.nameModel /= next)
|
||||||
|
|
||||||
|
SetAllName str ->
|
||||||
|
let
|
||||||
|
next =
|
||||||
|
Util.Maybe.fromString str
|
||||||
|
in
|
||||||
|
NextState
|
||||||
|
( { model | allNameModel = next }
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
(model.allNameModel /= next)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- View
|
-- 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" ]
|
, div [ class "field" ]
|
||||||
[ label [] [ text "Name or Notes" ]
|
[ label [] [ text "Name or Notes" ]
|
||||||
, input
|
, input
|
||||||
@ -506,12 +536,15 @@ view settings model =
|
|||||||
]
|
]
|
||||||
[]
|
[]
|
||||||
, span [ class "small-info" ]
|
, span [ class "small-info" ]
|
||||||
[ text "Use wildcards "
|
[ text "Looks in item name and notes only."
|
||||||
, code [] [ text "*" ]
|
|
||||||
, text " at beginning or end. Added automatically if not "
|
|
||||||
, text "present and not quoted."
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
, 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"
|
, formHeader (Icons.tagsIcon "") "Tags"
|
||||||
, div [ class "field" ]
|
, div [ class "field" ]
|
||||||
[ label [] [ text "Include (and)" ]
|
[ label [] [ text "Include (and)" ]
|
||||||
|
@ -35,7 +35,7 @@ update key flags settings msg model =
|
|||||||
{ model | searchMenuModel = Tuple.first nextState.modelCmd }
|
{ model | searchMenuModel = Tuple.first nextState.modelCmd }
|
||||||
|
|
||||||
( m2, c2 ) =
|
( m2, c2 ) =
|
||||||
if nextState.stateChange then
|
if nextState.stateChange && not model.searchInProgress then
|
||||||
doSearch flags settings newModel
|
doSearch flags settings newModel
|
||||||
|
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user