diff --git a/modules/webapp/src/main/elm/Api.elm b/modules/webapp/src/main/elm/Api.elm index 317aa53c..45b2adf0 100644 --- a/modules/webapp/src/main/elm/Api.elm +++ b/modules/webapp/src/main/elm/Api.elm @@ -92,6 +92,7 @@ module Api exposing , startOnceScanMailbox , startReIndex , submitNotifyDueItems + , toggleTags , updateNotifyDueItems , updateScanMailbox , upload @@ -148,6 +149,7 @@ import Api.Model.SentMails exposing (SentMails) import Api.Model.SimpleMail exposing (SimpleMail) import Api.Model.Source exposing (Source) import Api.Model.SourceList exposing (SourceList) +import Api.Model.StringList exposing (StringList) import Api.Model.Tag exposing (Tag) import Api.Model.TagCloud exposing (TagCloud) import Api.Model.TagList exposing (TagList) @@ -1304,6 +1306,16 @@ setTags flags item tags receive = } +toggleTags : Flags -> String -> StringList -> (Result Http.Error BasicResult -> msg) -> Cmd msg +toggleTags flags item tags receive = + Http2.authPost + { url = flags.config.baseUrl ++ "/api/v1/sec/item/" ++ item ++ "/tagtoggle" + , account = getAccount flags + , body = Http.jsonBody (Api.Model.StringList.encode tags) + , expect = Http.expectJson receive Api.Model.BasicResult.decoder + } + + addTag : Flags -> String -> Tag -> (Result Http.Error BasicResult -> msg) -> Cmd msg addTag flags item tag receive = Http2.authPost diff --git a/modules/webapp/src/main/elm/Page/Home/Update.elm b/modules/webapp/src/main/elm/Page/Home/Update.elm index b424abb0..69ce2d41 100644 --- a/modules/webapp/src/main/elm/Page/Home/Update.elm +++ b/modules/webapp/src/main/elm/Page/Home/Update.elm @@ -48,16 +48,7 @@ update key flags settings msg model = model.searchMenuModel dropCmd = - case nextState.dragDrop.dropped of - Just dropped -> - let - _ = - Debug.log "item/folder" dropped - in - DD.makeUpdateCmd flags (\_ -> DoSearch) nextState.dragDrop.dropped - - Nothing -> - Cmd.none + DD.makeUpdateCmd flags (\_ -> DoSearch) nextState.dragDrop.dropped newModel = { model diff --git a/modules/webapp/src/main/elm/Util/ItemDragDrop.elm b/modules/webapp/src/main/elm/Util/ItemDragDrop.elm index 834d22e0..f9a2d6ba 100644 --- a/modules/webapp/src/main/elm/Util/ItemDragDrop.elm +++ b/modules/webapp/src/main/elm/Util/ItemDragDrop.elm @@ -15,6 +15,7 @@ module Util.ItemDragDrop exposing import Api import Api.Model.BasicResult exposing (BasicResult) import Api.Model.OptionalId exposing (OptionalId) +import Api.Model.StringList exposing (StringList) import Data.Flags exposing (Flags) import Html exposing (Attribute) import Html5.DragDrop as DD @@ -76,12 +77,8 @@ makeUpdateCmd flags receive droppedMaybe = FolderRemove -> Api.setFolder flags dropped.itemId (OptionalId Nothing) receive - Tag _ -> - let - _ = - Debug.log "dropped" dropped - in - Cmd.none + Tag tid -> + Api.toggleTags flags dropped.itemId (StringList [ tid ]) receive Nothing -> Cmd.none