mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Allow editing metadata in item-detail
This commit is contained in:
@ -122,6 +122,9 @@ type Msg
|
||||
| EditAttachNameResp (Result Http.Error BasicResult)
|
||||
| GetFolderResp (Result Http.Error FolderList)
|
||||
| FolderDropdownMsg (Comp.Dropdown.Msg IdName)
|
||||
| StartEditCorrOrgModal
|
||||
| StartEditPersonModal (Comp.Dropdown.Model IdName)
|
||||
| StartEditEquipModal
|
||||
|
||||
|
||||
update : Nav.Key -> Flags -> Maybe String -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
@ -1046,6 +1049,42 @@ update key flags next msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
StartEditCorrOrgModal ->
|
||||
let
|
||||
orgId =
|
||||
Comp.Dropdown.getSelected model.corrOrgModel
|
||||
|> List.head
|
||||
|> Maybe.map .id
|
||||
in
|
||||
case orgId of
|
||||
Just oid ->
|
||||
let
|
||||
( m, c ) =
|
||||
Comp.DetailEdit.editOrg flags oid Comp.OrgForm.emptyModel
|
||||
in
|
||||
noSub ( { model | modalEdit = Just m }, Cmd.map ModalEditMsg c )
|
||||
|
||||
Nothing ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
StartEditEquipModal ->
|
||||
let
|
||||
equipId =
|
||||
Comp.Dropdown.getSelected model.concEquipModel
|
||||
|> List.head
|
||||
|> Maybe.map .id
|
||||
in
|
||||
case equipId of
|
||||
Just eid ->
|
||||
let
|
||||
( m, c ) =
|
||||
Comp.DetailEdit.editEquip flags eid Comp.EquipmentForm.emptyModel
|
||||
in
|
||||
noSub ( { model | modalEdit = Just m }, Cmd.map ModalEditMsg c )
|
||||
|
||||
Nothing ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
StartCorrPersonModal ->
|
||||
noSub
|
||||
( { model
|
||||
@ -1072,6 +1111,24 @@ update key flags next msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
StartEditPersonModal pm ->
|
||||
let
|
||||
persId =
|
||||
Comp.Dropdown.getSelected pm
|
||||
|> List.head
|
||||
|> Maybe.map .id
|
||||
in
|
||||
case persId of
|
||||
Just pid ->
|
||||
let
|
||||
( m, c ) =
|
||||
Comp.DetailEdit.editPerson flags pid Comp.PersonForm.emptyModel
|
||||
in
|
||||
noSub ( { model | modalEdit = Just m }, Cmd.map ModalEditMsg c )
|
||||
|
||||
Nothing ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
StartEquipModal ->
|
||||
noSub
|
||||
( { model
|
||||
|
@ -741,6 +741,19 @@ renderEditForm settings model =
|
||||
]
|
||||
[ i [ class "grey plus link icon" ] []
|
||||
]
|
||||
|
||||
editIconLink tip dm m =
|
||||
a
|
||||
[ classList
|
||||
[ ( "right-float", True )
|
||||
, ( "invisible hidden", Comp.Dropdown.notSelected dm )
|
||||
]
|
||||
, href "#"
|
||||
, title tip
|
||||
, onClick m
|
||||
]
|
||||
[ i [ class "grey pencil alternate link icon" ] []
|
||||
]
|
||||
in
|
||||
div [ class "ui attached segment" ]
|
||||
[ div [ class "ui form warning" ]
|
||||
@ -834,6 +847,7 @@ item visible. This message will disappear then.
|
||||
[ Icons.organizationIcon "grey"
|
||||
, text "Organization"
|
||||
, addIconLink "Add new organization" StartCorrOrgModal
|
||||
, editIconLink "Edit organization" model.corrOrgModel StartEditCorrOrgModal
|
||||
]
|
||||
, Html.map OrgDropdownMsg (Comp.Dropdown.view settings model.corrOrgModel)
|
||||
, renderOrgSuggestions model
|
||||
@ -843,6 +857,9 @@ item visible. This message will disappear then.
|
||||
[ Icons.personIcon "grey"
|
||||
, text "Person"
|
||||
, addIconLink "Add new correspondent person" StartCorrPersonModal
|
||||
, editIconLink "Edit person"
|
||||
model.corrPersonModel
|
||||
(StartEditPersonModal model.corrPersonModel)
|
||||
]
|
||||
, Html.map CorrPersonMsg (Comp.Dropdown.view settings model.corrPersonModel)
|
||||
, renderCorrPersonSuggestions model
|
||||
@ -856,6 +873,9 @@ item visible. This message will disappear then.
|
||||
[ Icons.personIcon "grey"
|
||||
, text "Person"
|
||||
, addIconLink "Add new concerning person" StartConcPersonModal
|
||||
, editIconLink "Edit person"
|
||||
model.concPersonModel
|
||||
(StartEditPersonModal model.concPersonModel)
|
||||
]
|
||||
, Html.map ConcPersonMsg (Comp.Dropdown.view settings model.concPersonModel)
|
||||
, renderConcPersonSuggestions model
|
||||
@ -865,6 +885,9 @@ item visible. This message will disappear then.
|
||||
[ Icons.equipmentIcon "grey"
|
||||
, text "Equipment"
|
||||
, addIconLink "Add new equipment" StartEquipModal
|
||||
, editIconLink "Edit equipment"
|
||||
model.concEquipModel
|
||||
StartEditEquipModal
|
||||
]
|
||||
, Html.map ConcEquipMsg (Comp.Dropdown.view settings model.concEquipModel)
|
||||
, renderConcEquipSuggestions model
|
||||
|
Reference in New Issue
Block a user