Add the attachment-only option to a source

The upload request can now contain a boolean for importing only
attachments when e-mails are uploaded. This option is now also added
to a source url.

Refs: #983
This commit is contained in:
eikek
2021-08-23 14:19:11 +02:00
parent 45f6357f49
commit 993a391c13
9 changed files with 71 additions and 7 deletions

View File

@ -57,6 +57,7 @@ type alias Model =
, fileFilter : Maybe String
, languageModel : Comp.Dropdown.Model Language
, language : Maybe String
, attachmentsOnly : Bool
}
@ -80,6 +81,7 @@ emptyModel =
, selected = Nothing
}
, language = Nothing
, attachmentsOnly = False
}
@ -119,6 +121,7 @@ getSource model =
, folder = model.folderId
, fileFilter = model.fileFilter
, language = model.language
, attachmentsOnly = model.attachmentsOnly
}
in
{ st | source = n, tags = TagList (List.length tags) tags }
@ -136,6 +139,7 @@ type Msg
| TagDropdownMsg (Comp.Dropdown.Msg Tag)
| SetFileFilter String
| LanguageMsg (Comp.Dropdown.Msg Language)
| ToggleAttachmentsOnly
@ -219,6 +223,9 @@ update flags msg model =
ToggleEnabled ->
( { model | enabled = not model.enabled }, Cmd.none )
ToggleAttachmentsOnly ->
( { model | attachmentsOnly = not model.attachmentsOnly }, Cmd.none )
SetAbbrev n ->
( { model | abbrev = n }, Cmd.none )
@ -496,6 +503,24 @@ view2 flags texts settings model =
[ Markdown.toHtml [] texts.fileFilterInfo
]
]
, div [ class "mb-4" ]
[ label
[ class "inline-flex items-center"
, for "attachments-only"
]
[ input
[ type_ "checkbox"
, onCheck (\_ -> ToggleAttachmentsOnly)
, checked model.attachmentsOnly
, class S.checkboxInput
, id "attachments-only"
]
[]
, span [ class "ml-2" ]
[ text texts.attachmentsOnly
]
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text (texts.language ++ ":")