mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-04 14:15:59 +00:00
Toggle tags via drag-drop from list view
This commit is contained in:
parent
06ad9ac46c
commit
000d1aff2b
@ -92,6 +92,7 @@ module Api exposing
|
|||||||
, startOnceScanMailbox
|
, startOnceScanMailbox
|
||||||
, startReIndex
|
, startReIndex
|
||||||
, submitNotifyDueItems
|
, submitNotifyDueItems
|
||||||
|
, toggleTags
|
||||||
, updateNotifyDueItems
|
, updateNotifyDueItems
|
||||||
, updateScanMailbox
|
, updateScanMailbox
|
||||||
, upload
|
, upload
|
||||||
@ -148,6 +149,7 @@ import Api.Model.SentMails exposing (SentMails)
|
|||||||
import Api.Model.SimpleMail exposing (SimpleMail)
|
import Api.Model.SimpleMail exposing (SimpleMail)
|
||||||
import Api.Model.Source exposing (Source)
|
import Api.Model.Source exposing (Source)
|
||||||
import Api.Model.SourceList exposing (SourceList)
|
import Api.Model.SourceList exposing (SourceList)
|
||||||
|
import Api.Model.StringList exposing (StringList)
|
||||||
import Api.Model.Tag exposing (Tag)
|
import Api.Model.Tag exposing (Tag)
|
||||||
import Api.Model.TagCloud exposing (TagCloud)
|
import Api.Model.TagCloud exposing (TagCloud)
|
||||||
import Api.Model.TagList exposing (TagList)
|
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 -> String -> Tag -> (Result Http.Error BasicResult -> msg) -> Cmd msg
|
||||||
addTag flags item tag receive =
|
addTag flags item tag receive =
|
||||||
Http2.authPost
|
Http2.authPost
|
||||||
|
@ -48,16 +48,7 @@ update key flags settings msg model =
|
|||||||
model.searchMenuModel
|
model.searchMenuModel
|
||||||
|
|
||||||
dropCmd =
|
dropCmd =
|
||||||
case nextState.dragDrop.dropped of
|
DD.makeUpdateCmd flags (\_ -> DoSearch) nextState.dragDrop.dropped
|
||||||
Just dropped ->
|
|
||||||
let
|
|
||||||
_ =
|
|
||||||
Debug.log "item/folder" dropped
|
|
||||||
in
|
|
||||||
DD.makeUpdateCmd flags (\_ -> DoSearch) nextState.dragDrop.dropped
|
|
||||||
|
|
||||||
Nothing ->
|
|
||||||
Cmd.none
|
|
||||||
|
|
||||||
newModel =
|
newModel =
|
||||||
{ model
|
{ model
|
||||||
|
@ -15,6 +15,7 @@ module Util.ItemDragDrop exposing
|
|||||||
import Api
|
import Api
|
||||||
import Api.Model.BasicResult exposing (BasicResult)
|
import Api.Model.BasicResult exposing (BasicResult)
|
||||||
import Api.Model.OptionalId exposing (OptionalId)
|
import Api.Model.OptionalId exposing (OptionalId)
|
||||||
|
import Api.Model.StringList exposing (StringList)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Html exposing (Attribute)
|
import Html exposing (Attribute)
|
||||||
import Html5.DragDrop as DD
|
import Html5.DragDrop as DD
|
||||||
@ -76,12 +77,8 @@ makeUpdateCmd flags receive droppedMaybe =
|
|||||||
FolderRemove ->
|
FolderRemove ->
|
||||||
Api.setFolder flags dropped.itemId (OptionalId Nothing) receive
|
Api.setFolder flags dropped.itemId (OptionalId Nothing) receive
|
||||||
|
|
||||||
Tag _ ->
|
Tag tid ->
|
||||||
let
|
Api.toggleTags flags dropped.itemId (StringList [ tid ]) receive
|
||||||
_ =
|
|
||||||
Debug.log "dropped" dropped
|
|
||||||
in
|
|
||||||
Cmd.none
|
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
Cmd.none
|
Cmd.none
|
||||||
|
Loading…
x
Reference in New Issue
Block a user