mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-10-31 09:30:12 +00:00 
			
		
		
		
	Toggle tags via drag-drop from list view
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user