Externalize strings in usersettings page

This commit is contained in:
Eike Kettner 2021-04-04 21:57:34 +02:00
parent 594818499e
commit 9c1beb2240
38 changed files with 1145 additions and 446 deletions

View File

@ -1,6 +1,7 @@
module Comp.EmailInput exposing
( Model
, Msg
, ViewSettings
, init
, update
, view2
@ -137,10 +138,16 @@ update flags current msg model =
--- View2
view2 : DS.DropdownStyle -> List String -> Model -> Html Msg
view2 style values model =
type alias ViewSettings =
{ placeholder : String
, style : DS.DropdownStyle
}
view2 : ViewSettings -> List String -> Model -> Html Msg
view2 cfg values model =
div [ class "text-sm flex-row space-x-2 relative" ]
[ div [ class style.link ]
[ div [ class cfg.style.link ]
[ div
[ class "flex flex-row space-x-2 mr-2"
, classList [ ( "hidden", List.isEmpty values ) ]
@ -149,7 +156,7 @@ view2 style values model =
, input
[ type_ "text"
, value model.input
, placeholder "Recipients"
, placeholder cfg.placeholder
, onKeyUp KeyPress
, onInput SetInput
, class "inline-flex w-24 border-0 px-0 focus:ring-0 h-6 text-sm"
@ -157,7 +164,7 @@ view2 style values model =
]
[]
]
, renderMenu2 style model
, renderMenu2 cfg.style model
]

View File

@ -21,6 +21,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Messages.EmailSettingsFormComp exposing (Texts)
import Styles as S
import Util.Maybe
@ -170,13 +171,13 @@ update msg model =
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
view2 : Texts -> UiSettings -> Model -> Html Msg
view2 texts settings model =
let
sslCfg =
{ makeOption =
\s ->
{ text = Data.SSLType.label s
{ text = texts.sslTypeLabel s
, additional = ""
}
, placeholder = ""
@ -189,14 +190,14 @@ view2 settings model =
[ label
[ class S.inputLabel
]
[ text "Name"
[ text texts.name
, B.inputRequired
]
, input
[ type_ "text"
, value model.name
, onInput SetName
, placeholder "Connection name, e.g. 'gmail.com'"
, placeholder texts.connectionPlaceholder
, class S.textInput
, classList [ ( S.inputErrorBorder, model.name == "" ) ]
]
@ -205,17 +206,17 @@ view2 settings model =
[ class S.message
, class "mt-2"
]
[ text "The connection name must not contain whitespace or special characters."
[ text texts.connectionNameInfo
]
]
, div [ class "col-span-3" ]
[ label [ class S.inputLabel ]
[ text "SMTP Host"
[ text texts.smtpHost
, B.inputRequired
]
, input
[ type_ "text"
, placeholder "SMTP host name, e.g. 'mail.gmail.com'"
, placeholder texts.smtpHostPlaceholder
, value model.host
, onInput SetHost
, class S.textInput
@ -233,11 +234,11 @@ view2 settings model =
[ label
[ class S.inputLabel
]
[ text "SMTP User"
[ text texts.smtpUser
]
, input
[ type_ "text"
, placeholder "SMTP Username, e.g. 'your.name@gmail.com'"
, placeholder texts.smtpUserPlaceholder
, Maybe.withDefault "" model.user |> value
, onInput SetUser
, class S.textInput
@ -246,11 +247,11 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "SMTP Password"
[ text texts.smtpPassword
]
, Html.map PassMsg
(Comp.PasswordInput.view2
{ placeholder = "Password" }
{ placeholder = texts.smtpPasswordPlaceholder }
model.password
False
model.passField
@ -258,12 +259,12 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "From Address"
[ text texts.fromAddress
, B.inputRequired
]
, input
[ type_ "text"
, placeholder "Sender E-Mail address"
, placeholder texts.fromAddressPlaceholder
, value model.from
, onInput SetFrom
, class S.textInput
@ -273,11 +274,11 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "Reply-To"
[ text texts.replyTo
]
, input
[ type_ "text"
, placeholder "Optional reply-to E-Mail address"
, placeholder texts.replyToPlaceholder
, Maybe.withDefault "" model.replyTo |> value
, onInput SetReplyTo
, class S.textInput
@ -286,7 +287,7 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "SSL"
[ text texts.ssl
]
, Html.map SSLTypeMsg
(Comp.Dropdown.view2
@ -299,7 +300,7 @@ view2 settings model =
[ MB.viewItem <|
MB.Checkbox
{ tagger = \_ -> ToggleCheckCert
, label = "Ignore certificate check"
, label = texts.ignoreCertCheck
, value = model.ignoreCertificates
, id = "smpt-no-cert-check"
}

View File

@ -21,6 +21,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Http
import Messages.EmailSettingsManageComp exposing (Texts)
import Styles as S
import Util.Http
@ -206,71 +207,74 @@ update flags msg model =
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
view2 : Texts -> UiSettings -> Model -> Html Msg
view2 texts settings model =
case model.viewMode of
Table ->
viewTable2 model
viewTable2 texts model
Form ->
viewForm2 settings model
viewForm2 texts settings model
viewTable2 : Model -> Html Msg
viewTable2 model =
viewTable2 : Texts -> Model -> Html Msg
viewTable2 texts model =
div []
[ MB.view
{ start =
[ MB.TextInput
{ tagger = SetQuery
, value = model.query
, placeholder = "Search"
, placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search"
}
]
, end =
[ MB.PrimaryButton
{ tagger = InitNew
, title = "Add new SMTP settings"
, title = texts.addNewSmtpSettings
, icon = Just "fa fa-plus"
, label = "New Settings"
, label = texts.newSettings
}
]
, rootClasses = "mb-4"
}
, Html.map TableMsg (Comp.EmailSettingsTable.view2 model.tableModel)
, Html.map TableMsg
(Comp.EmailSettingsTable.view2 texts.settingsTable
model.tableModel
)
]
viewForm2 : UiSettings -> Model -> Html Msg
viewForm2 settings model =
viewForm2 : Texts -> UiSettings -> Model -> Html Msg
viewForm2 texts settings model =
let
dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete these connection?"
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteConnection
in
div [ class "flex flex-col md:relative" ]
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = Submit
, title = "Submit this form"
, title = texts.basics.submitThisForm
, icon = Just "fa fa-save"
, label = "Submit"
, label = texts.basics.submit
}
, MB.SecondaryButton
{ tagger = SetViewMode Table
, title = "Back to list"
, title = texts.basics.backToList
, icon = Just "fa fa-arrow-left"
, label = "Cancel"
, label = texts.basics.cancel
}
]
, end =
if model.formModel.settings.name /= "" then
[ MB.DeleteButton
{ tagger = RequestDelete
, title = "Delete this settings entry"
, title = texts.deleteThisEntry
, icon = Just "fa fa-trash"
, label = "Delete"
, label = texts.basics.delete
}
]
@ -288,7 +292,10 @@ viewForm2 settings model =
[ Maybe.withDefault "" model.formError |> text
]
, Html.map FormMsg
(Comp.EmailSettingsForm.view2 settings model.formModel)
(Comp.EmailSettingsForm.view2 texts.settingsForm
settings
model.formModel
)
, Html.map YesNoMsg
(Comp.YesNoDimmer.viewN
True

View File

@ -11,6 +11,7 @@ import Api.Model.EmailSettings exposing (EmailSettings)
import Comp.Basic as B
import Html exposing (..)
import Html.Attributes exposing (..)
import Messages.EmailSettingsTableComp exposing (Texts)
import Styles as S
@ -47,15 +48,15 @@ update msg model =
--- View2
view2 : Model -> Html Msg
view2 model =
view2 : Texts -> Model -> Html Msg
view2 texts model =
table [ class S.tableMain ]
[ thead []
[ tr []
[ th [ class "" ] []
, th [ class "text-left mr-2" ] [ text "Name" ]
, th [ class "text-left mr-2" ] [ text "Host/Port" ]
, th [ class "text-left mr-2 hidden sm:table-cell" ] [ text "From" ]
, th [ class "text-left mr-2" ] [ text texts.name ]
, th [ class "text-left mr-2" ] [ text texts.hostPort ]
, th [ class "text-left mr-2 hidden sm:table-cell" ] [ text texts.from ]
]
]
, tbody []

View File

@ -21,6 +21,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Messages.ImapSettingsFormComp exposing (Texts)
import Styles as S
import Util.Maybe
@ -162,13 +163,13 @@ update msg model =
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
view2 : Texts -> UiSettings -> Model -> Html Msg
view2 texts settings model =
let
sslCfg =
{ makeOption =
\s ->
{ text = Data.SSLType.label s
{ text = texts.sslTypeLabel s
, additional = ""
}
, placeholder = ""
@ -180,14 +181,14 @@ view2 settings model =
[ class "grid grid-cols-4 gap-y-4 gap-x-2" ]
[ div [ class "col-span-4" ]
[ label [ class S.inputLabel ]
[ text "Name"
[ text texts.name
, B.inputRequired
]
, input
[ type_ "text"
, value model.name
, onInput SetName
, placeholder "Connection name, e.g. 'gmail.com'"
, placeholder texts.connectionNamePlaceholder
, class S.textInput
, classList [ ( S.inputErrorBorder, model.name == "" ) ]
]
@ -196,17 +197,17 @@ view2 settings model =
[ class S.message
, class "mt-2"
]
[ text "The connection name must not contain whitespace or special characters."
[ text texts.connectionNameInfo
]
]
, div [ class "col-span-3" ]
[ label [ class S.inputLabel ]
[ text "IMAP Host"
[ text texts.imapHost
, B.inputRequired
]
, input
[ type_ "text"
, placeholder "IMAP host name, e.g. 'mail.gmail.com'"
, placeholder texts.imapHostPlaceholder
, value model.host
, onInput SetHost
, class S.textInput
@ -222,11 +223,11 @@ view2 settings model =
)
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "IMAP User"
[ text texts.imapUser
]
, input
[ type_ "text"
, placeholder "IMAP Username, e.g. 'your.name@gmail.com'"
, placeholder texts.imapUserPlaceholder
, Maybe.withDefault "" model.user |> value
, onInput SetUser
, class S.textInput
@ -235,10 +236,10 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "IMAP Password" ]
[ text texts.imapPassword ]
, Html.map PassMsg
(Comp.PasswordInput.view2
{ placeholder = "Password" }
{ placeholder = texts.imapPasswordPlaceholder }
model.password
False
model.passField
@ -246,7 +247,7 @@ view2 settings model =
]
, div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ]
[ text "SSL"
[ text texts.ssl
]
, Html.map SSLTypeMsg
(Comp.Dropdown.view2
@ -259,7 +260,7 @@ view2 settings model =
[ MB.viewItem <|
MB.Checkbox
{ tagger = \_ -> ToggleCheckCert
, label = "Ignore certificate check"
, label = texts.ignoreCertCheck
, value = model.ignoreCertificates
, id = "imap-no-cert-check"
}
@ -268,12 +269,12 @@ view2 settings model =
[ MB.viewItem <|
MB.Checkbox
{ tagger = \_ -> ToggleUseOAuth
, label = "Enable OAuth2 authentication"
, label = texts.enableOAuth2
, value = model.useOAuthToken
, id = "imap-use-oauth"
}
, div [ class "opacity-50 text-sm" ]
[ text "Enabling this, allows to connect via XOAuth using the password as access token."
[ text texts.oauth2Info
]
]
]

View File

@ -21,6 +21,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Http
import Messages.ImapSettingsManageComp exposing (Texts)
import Styles as S
import Util.Http
@ -206,74 +207,75 @@ update flags msg model =
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
view2 : Texts -> UiSettings -> Model -> Html Msg
view2 texts settings model =
case model.viewMode of
Table ->
viewTable2 model
viewTable2 texts model
Form ->
viewForm2 settings model
viewForm2 texts settings model
viewTable2 : Model -> Html Msg
viewTable2 model =
viewTable2 : Texts -> Model -> Html Msg
viewTable2 texts model =
div []
[ MB.view
{ start =
[ MB.TextInput
{ tagger = SetQuery
, value = model.query
, placeholder = "Search"
, placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search"
}
]
, end =
[ MB.PrimaryButton
{ tagger = InitNew
, title = "Add new SMTP settings"
, title = texts.addNewImapSettings
, icon = Just "fa fa-plus"
, label = "New Settings"
, label = texts.newSettings
}
]
, rootClasses = "mb-4"
}
, Html.map TableMsg
(Comp.ImapSettingsTable.view2
texts.imapTable
model.tableModel
)
]
viewForm2 : UiSettings -> Model -> Html Msg
viewForm2 settings model =
viewForm2 : Texts -> UiSettings -> Model -> Html Msg
viewForm2 texts settings model =
let
dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this mail-box connection?"
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteSettings
in
div [ class "flex flex-col md:relative" ]
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = Submit
, title = "Submit this form"
, title = texts.basics.submitThisForm
, icon = Just "fa fa-save"
, label = "Submit"
, label = texts.basics.submit
}
, MB.SecondaryButton
{ tagger = SetViewMode Table
, title = "Back to list"
, title = texts.basics.backToList
, icon = Just "fa fa-arrow-left"
, label = "Cancel"
, label = texts.basics.cancel
}
]
, end =
if model.formModel.settings.name /= "" then
[ MB.DeleteButton
{ tagger = RequestDelete
, title = "Delete this settings entry"
, title = texts.deleteThisEntry
, icon = Just "fa fa-trash"
, label = "Delete"
, label = texts.basics.delete
}
]
@ -292,6 +294,7 @@ viewForm2 settings model =
]
, Html.map FormMsg
(Comp.ImapSettingsForm.view2
texts.imapForm
settings
model.formModel
)

View File

@ -11,6 +11,7 @@ import Api.Model.ImapSettings exposing (ImapSettings)
import Comp.Basic as B
import Html exposing (..)
import Html.Attributes exposing (..)
import Messages.ImapSettingsTableComp exposing (Texts)
import Styles as S
@ -47,14 +48,14 @@ update msg model =
--- View2
view2 : Model -> Html Msg
view2 model =
view2 : Texts -> Model -> Html Msg
view2 texts model =
table [ class S.tableMain ]
[ thead []
[ tr []
[ th [] []
, th [ class "text-left mr-2" ] [ text "Name" ]
, th [ class "text-left mr-2" ] [ text "Host/Port" ]
, th [ class "text-left mr-2" ] [ text texts.name ]
, th [ class "text-left mr-2" ] [ text texts.hostPort ]
]
]
, tbody []

View File

@ -8,6 +8,8 @@ module Comp.IntField exposing
, viewWithInfo2
)
--- L10N TODO
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)

View File

@ -3,7 +3,7 @@ module Comp.ItemDetail.EditForm exposing (formTabs, view2)
import Comp.CustomFieldMultiInput
import Comp.DatePicker
import Comp.Dropdown
import Comp.ItemDetail.FieldTabState as FTabState
import Comp.ItemDetail.FieldTabState as FTabState exposing (EditTab(..))
import Comp.ItemDetail.Model
exposing
( Model
@ -143,7 +143,8 @@ formTabs flags settings model =
, style = dds
}
in
[ { title = "Name"
[ { name = FTabState.tabName TabName
, title = "Name"
, titleRight = []
, info = Nothing
, body =
@ -169,7 +170,8 @@ formTabs flags settings model =
]
]
}
, { title = "Date"
, { name = FTabState.tabName TabDate
, title = "Date"
, titleRight = []
, info = Nothing
, body =
@ -194,7 +196,8 @@ formTabs flags settings model =
]
]
}
, { title = "Tags"
, { name = FTabState.tabName TabTags
, title = "Tags"
, titleRight = []
, info = Nothing
, body =
@ -217,7 +220,8 @@ formTabs flags settings model =
]
]
}
, { title = "Folder"
, { name = FTabState.tabName TabFolder
, title = "Folder"
, titleRight = []
, info = Nothing
, body =
@ -243,7 +247,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Custom Fields"
, { name = FTabState.tabName TabCustomFields
, title = "Custom Fields"
, titleRight = []
, info = Nothing
, body =
@ -257,7 +262,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Due Date"
, { name = FTabState.tabName TabDueDate
, title = "Due Date"
, titleRight = []
, info = Nothing
, body =
@ -282,7 +288,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Correspondent"
, { name = FTabState.tabName TabCorrespondent
, title = "Correspondent"
, titleRight = []
, info = Nothing
, body =
@ -331,7 +338,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Concerning"
, { name = FTabState.tabName TabConcerning
, title = "Concerning"
, titleRight = []
, info = Nothing
, body =
@ -373,7 +381,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Direction"
, { name = FTabState.tabName TabDirection
, title = "Direction"
, titleRight = []
, info = Nothing
, body =
@ -494,4 +503,4 @@ tabState settings allNames model =
FTabState.tabState settings
openTabs
Nothing
(.title >> ToggleAkkordionTab)
(.name >> ToggleAkkordionTab)

View File

@ -1,4 +1,4 @@
module Comp.ItemDetail.FieldTabState exposing (tabState)
module Comp.ItemDetail.FieldTabState exposing (EditTab(..), findTab, tabName, tabState)
import Comp.CustomFieldMultiInput
import Comp.Tabs as TB
@ -7,6 +7,87 @@ import Data.UiSettings exposing (UiSettings)
import Set exposing (Set)
type EditTab
= TabName
| TabDate
| TabTags
| TabFolder
| TabCustomFields
| TabDueDate
| TabCorrespondent
| TabConcerning
| TabDirection
| TabConfirmUnconfirm
tabName : EditTab -> String
tabName tab =
case tab of
TabName ->
"name"
TabTags ->
"tags"
TabDate ->
"date"
TabFolder ->
"folder"
TabCustomFields ->
"custom-fields"
TabDueDate ->
"due-date"
TabCorrespondent ->
"correspondent"
TabConcerning ->
"concerning"
TabDirection ->
"direction"
TabConfirmUnconfirm ->
"confirm-unconfirm"
findTab : TB.Tab msg -> Maybe EditTab
findTab tab =
case tab.name of
"name" ->
Just TabName
"tags" ->
Just TabTags
"date" ->
Just TabDate
"folder" ->
Just TabFolder
"custom-fields" ->
Just TabCustomFields
"due-date" ->
Just TabDueDate
"correspondent" ->
Just TabCorrespondent
"concerning" ->
Just TabConcerning
"direction" ->
Just TabDirection
_ ->
Nothing
tabState :
UiSettings
-> Set String
@ -20,32 +101,32 @@ tabState settings openTabs cfmodel toggle tab =
Data.UiSettings.fieldHidden settings f
hidden =
case tab.title of
"Tags" ->
case findTab tab of
Just TabTags ->
isHidden Data.Fields.Tag
"Folder" ->
Just TabFolder ->
isHidden Data.Fields.Folder
"Correspondent" ->
Just TabCorrespondent ->
isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson
"Concerning" ->
Just TabConcerning ->
isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson
"Custom Fields" ->
Just TabCustomFields ->
isHidden Data.Fields.CustomFields
|| (Maybe.map Comp.CustomFieldMultiInput.isEmpty cfmodel
|> Maybe.withDefault False
)
"Date" ->
Just TabDate ->
isHidden Data.Fields.Date
"Due Date" ->
Just TabDueDate ->
isHidden Data.Fields.DueDate
"Direction" ->
Just TabDirection ->
isHidden Data.Fields.Direction
_ ->
@ -55,7 +136,7 @@ tabState settings openTabs cfmodel toggle tab =
if hidden then
TB.Hidden
else if Set.member tab.title openTabs then
else if Set.member tab.name openTabs then
TB.Open
else

View File

@ -22,7 +22,7 @@ import Comp.CustomFieldMultiInput
import Comp.DatePicker
import Comp.DetailEdit
import Comp.Dropdown exposing (isDropdownChangeMsg)
import Comp.ItemDetail.FieldTabState as FTabState
import Comp.ItemDetail.FieldTabState as FTabState exposing (EditTab(..), tabName)
import Comp.ItemDetail.FormChange exposing (FormChange(..))
import Comp.Tabs as TB
import Data.CustomFieldChange exposing (CustomFieldChange(..))
@ -48,7 +48,6 @@ import Time
import Util.Folder exposing (mkFolderOption)
import Util.List
import Util.Maybe
import Util.Person
import Util.Tag
@ -560,14 +559,14 @@ update flags msg model =
in
UpdateResult model_ cmd_ Sub.none change
ToggleAkkordionTab title ->
ToggleAkkordionTab name ->
let
tabs =
if Set.member title model.openTabs then
Set.remove title model.openTabs
if Set.member name model.openTabs then
Set.remove name model.openTabs
else
Set.insert title model.openTabs
Set.insert name model.openTabs
in
UpdateResult { model | openTabs = tabs } Cmd.none Sub.none NoFormChange
@ -697,7 +696,8 @@ renderEditForm2 flags cfg settings model =
[ TB.akkordion
tabStyle
(tabState settings model)
[ { title = "Confirm/Unconfirm item metadata"
[ { name = tabName TabConfirmUnconfirm
, title = "Confirm/Unconfirm item metadata"
, titleRight = []
, info = Nothing
, body =
@ -721,7 +721,8 @@ renderEditForm2 flags cfg settings model =
]
]
}
, { title = "Tags"
, { name = tabName TabTags
, title = "Tags"
, titleRight = []
, info = Nothing
, body =
@ -748,7 +749,8 @@ renderEditForm2 flags cfg settings model =
]
]
}
, { title = "Folder"
, { name = tabName TabFolder
, title = "Folder"
, titleRight = []
, info = Nothing
, body =
@ -767,7 +769,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Custom Fields"
, { name = tabName TabCustomFields
, title = "Custom Fields"
, titleRight = []
, info = Nothing
, body =
@ -775,7 +778,8 @@ item visible. This message will disappear then.
(Comp.CustomFieldMultiInput.view2 dds customFieldSettings model.customFieldModel)
]
}
, { title = "Date"
, { name = tabName TabDate
, title = "Date"
, titleRight = []
, info = Nothing
, body =
@ -797,7 +801,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Due Date"
, { name = tabName TabDueDate
, title = "Due Date"
, titleRight = []
, info = Nothing
, body =
@ -819,7 +824,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Correspondent"
, { name = tabName TabCorrespondent
, title = "Correspondent"
, titleRight = []
, info = Nothing
, body =
@ -845,7 +851,8 @@ item visible. This message will disappear then.
]
]
}
, { title = "Concerning"
, { name = tabName TabConcerning
, title = "Concerning"
, titleRight = []
, info = Nothing
, body =
@ -873,14 +880,16 @@ item visible. This message will disappear then.
]
]
}
, { title = "Direction"
, { name = tabName TabDirection
, title = "Direction"
, titleRight = []
, info = Nothing
, body =
[ Html.map DirDropdownMsg (Comp.Dropdown.view2 directionCfg settings model.directionModel)
]
}
, { title = "Name"
, { name = tabName TabName
, title = "Name"
, titleRight = []
, info = Nothing
, body =

View File

@ -1469,14 +1469,14 @@ update key flags inav settings msg model =
ToggleAttachmentDropdown ->
resultModel { model | attachmentDropdownOpen = not model.attachmentDropdownOpen }
ToggleAkkordionTab title ->
ToggleAkkordionTab name ->
let
tabs =
if Set.member title model.editMenuTabsOpen then
Set.remove title model.editMenuTabsOpen
if Set.member name model.editMenuTabsOpen then
Set.remove name model.editMenuTabsOpen
else
Set.insert title model.editMenuTabsOpen
Set.insert name model.editMenuTabsOpen
in
resultModel { model | editMenuTabsOpen = tabs }

View File

@ -255,21 +255,30 @@ view2 settings model =
, B.inputRequired
]
, Html.map RecipientMsg
(Comp.EmailInput.view2 dds model.recipients model.recipientsModel)
(Comp.EmailInput.view2 { style = dds, placeholder = "Recipient(s)..." }
model.recipients
model.recipientsModel
)
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "CC(s)"
]
, Html.map CCRecipientMsg
(Comp.EmailInput.view2 dds model.ccRecipients model.ccRecipientsModel)
(Comp.EmailInput.view2 { style = dds, placeholder = "CC recipient(s)..." }
model.ccRecipients
model.ccRecipientsModel
)
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "BCC(s)"
]
, Html.map BCCRecipientMsg
(Comp.EmailInput.view2 dds model.bccRecipients model.bccRecipientsModel)
(Comp.EmailInput.view2 { style = dds, placeholder = "BCC recipient(s)..." }
model.bccRecipients
model.bccRecipientsModel
)
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]

View File

@ -30,6 +30,8 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import Http
import Markdown
import Messages.NotificationFormComp exposing (Texts)
import Styles as S
import Util.Http
import Util.Maybe
@ -474,23 +476,23 @@ isFormSuccess model =
|> Maybe.withDefault False
view2 : String -> UiSettings -> Model -> Html Msg
view2 extraClasses settings model =
view2 : Texts -> String -> UiSettings -> Model -> Html Msg
view2 texts extraClasses settings model =
let
dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this notification task?"
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTask
startOnceBtn =
MB.SecondaryButton
{ tagger = StartOnce
, label = "Start Once"
, title = "Start this task now"
, label = texts.startOnce
, title = texts.startTaskNow
, icon = Just "fa fa-play"
}
connectionCfg =
{ makeOption = \a -> { text = a, additional = "" }
, placeholder = "Select connection..."
, placeholder = texts.selectConnection
, labelColor = \_ -> \_ -> ""
, style = DS.mainStyle
}
@ -509,14 +511,14 @@ view2 extraClasses settings model =
{ start =
[ MB.PrimaryButton
{ tagger = Submit
, label = "Submit"
, title = "Save"
, label = texts.basics.submit
, title = texts.basics.submitThisForm
, icon = Just "fa fa-save"
}
, MB.SecondaryButton
{ tagger = Cancel
, label = "Cancel"
, title = "Back to list"
, label = texts.basics.cancel
, title = texts.basics.backToList
, icon = Just "fa fa-arrow-left"
}
]
@ -525,8 +527,8 @@ view2 extraClasses settings model =
[ startOnceBtn
, MB.DeleteButton
{ tagger = RequestDelete
, label = "Delete"
, title = "Delete this task"
, label = texts.basics.delete
, title = texts.deleteThisTask
, icon = Just "fa fa-trash"
}
]
@ -552,14 +554,14 @@ view2 extraClasses settings model =
[ MB.viewItem <|
MB.Checkbox
{ tagger = \_ -> ToggleEnabled
, label = "Enable or disable this task."
, label = texts.enableDisable
, value = model.enabled
, id = "notify-enabled"
}
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Summary"
[ text texts.summary
]
, input
[ type_ "text"
@ -570,12 +572,12 @@ view2 extraClasses settings model =
]
[]
, span [ class "opacity-50 text-sm" ]
[ text "Some human readable name, only for displaying"
[ text texts.summaryInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Send via"
[ text texts.sendVia
, B.inputRequired
]
, Html.map ConnMsg
@ -585,29 +587,29 @@ view2 extraClasses settings model =
model.connectionModel
)
, span [ class "opacity-50 text-sm" ]
[ text "The SMTP connection to use when sending notification mails."
[ text texts.sendViaInfo
]
]
, div [ class "mb-4" ]
[ label
[ class S.inputLabel
]
[ text "Recipient(s)"
[ text texts.recipients
, B.inputRequired
]
, Html.map RecipientMsg
(Comp.EmailInput.view2
DS.mainStyle
{ style = DS.mainStyle, placeholder = texts.recipients }
model.recipients
model.recipientsModel
)
, span [ class "opacity-50 text-sm" ]
[ text "One or more mail addresses, confirm each by pressing 'Return'."
[ text texts.recipientsInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Tags Include (and)" ]
[ text texts.tagsInclude ]
, Html.map TagIncMsg
(Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle)
@ -615,12 +617,12 @@ view2 extraClasses settings model =
model.tagInclModel
)
, span [ class "opacity-50 text-sm" ]
[ text "Items must have all the tags specified here."
[ text texts.tagsIncludeInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Tags Exclude (or)" ]
[ text texts.tagsExclude ]
, Html.map TagExcMsg
(Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle)
@ -628,12 +630,12 @@ view2 extraClasses settings model =
model.tagExclModel
)
, span [ class "small-info" ]
[ text "Items must not have any tag specified here."
[ text texts.tagsExcludeInfo
]
]
, Html.map RemindDaysMsg
(Comp.IntField.viewWithInfo2
"Select items with a due date *lower than* `today+remindDays`"
texts.remindDaysInfo
model.remindDays
"mb-4"
model.remindDaysModel
@ -644,20 +646,15 @@ view2 extraClasses settings model =
{ tagger = \_ -> ToggleCapOverdue
, id = "notify-toggle-cap-overdue"
, value = model.capOverdue
, label = "Cap overdue items"
, label = texts.capOverdue
}
, div [ class "opacity-50 text-sm" ]
[ text "If checked, only items with a due date"
, em [ class "font-italic" ]
[ text " greater than " ]
, code [ class "font-mono" ]
[ text "today-remindDays" ]
, text " are considered."
[ Markdown.toHtml [] texts.capOverdueInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Schedule"
[ text texts.schedule
, a
[ class "float-right"
, class S.link
@ -666,7 +663,7 @@ view2 extraClasses settings model =
]
[ i [ class "fa fa-question" ] []
, span [ class "pl-2" ]
[ text "Click here for help"
[ text texts.scheduleClickForHelp
]
]
]
@ -676,10 +673,7 @@ view2 extraClasses settings model =
model.scheduleModel
)
, span [ class "opacity-50 text-sm" ]
[ text "Specify how often and when this task should run. "
, text "Use English 3-letter weekdays. Either a single value, "
, text "a list (ex. 1,2,3), a range (ex. 1..3) or a '*' (meaning all) "
, text "is allowed for each part."
[ text texts.scheduleInfo
]
]
]

View File

@ -11,6 +11,7 @@ import Api.Model.NotificationSettings exposing (NotificationSettings)
import Comp.Basic as B
import Html exposing (..)
import Html.Attributes exposing (..)
import Messages.NotificationTableComp exposing (Texts)
import Styles as S
import Util.Html
@ -44,8 +45,8 @@ update msg model =
--- View2
view2 : Model -> List NotificationSettings -> Html Msg
view2 _ items =
view2 : Texts -> Model -> List NotificationSettings -> Html Msg
view2 texts _ items =
div []
[ table [ class S.tableMain ]
[ thead []
@ -54,13 +55,13 @@ view2 _ items =
, th [ class "text-center mr-2" ]
[ i [ class "fa fa-check" ] []
]
, th [ class "text-left " ] [ text "Summary" ]
, th [ class "text-left " ] [ text texts.summary ]
, th [ class "text-left hidden sm:table-cell mr-2" ]
[ text "Schedule" ]
[ text texts.schedule ]
, th [ class "text-left mr-2" ]
[ text "Connection" ]
[ text texts.connection ]
, th [ class "text-left hidden sm:table-cell mr-2" ]
[ text "Recipients" ]
[ text texts.recipients ]
]
]
, tbody []

View File

@ -18,6 +18,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Http
import Messages.NotificationManageComp exposing (Texts)
import Styles as S
import Util.Http
@ -212,8 +213,8 @@ update flags msg model =
--- View2
view2 : UiSettings -> Model -> Html Msg
view2 settings model =
view2 : Texts -> UiSettings -> Model -> Html Msg
view2 texts settings model =
div [ class "flex flex-col" ]
(div
[ classList
@ -229,34 +230,38 @@ view2 settings model =
]
:: (case model.detailModel of
Just msett ->
viewForm2 settings msett
viewForm2 texts settings msett
Nothing ->
viewList2 model
viewList2 texts model
)
)
viewForm2 : UiSettings -> Comp.NotificationForm.Model -> List (Html Msg)
viewForm2 settings model =
viewForm2 : Texts -> UiSettings -> Comp.NotificationForm.Model -> List (Html Msg)
viewForm2 texts settings model =
[ Html.map DetailMsg
(Comp.NotificationForm.view2 "flex flex-col" settings model)
(Comp.NotificationForm.view2 texts.notificationForm "flex flex-col" settings model)
]
viewList2 : Model -> List (Html Msg)
viewList2 model =
viewList2 : Texts -> Model -> List (Html Msg)
viewList2 texts model =
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = NewTask
, label = "New Task"
, label = texts.newTask
, icon = Just "fa fa-plus"
, title = "Create a new notification task"
, title = texts.createNewTask
}
]
, end = []
, rootClasses = "mb-4"
}
, Html.map ListMsg (Comp.NotificationList.view2 model.listModel model.items)
, Html.map ListMsg
(Comp.NotificationList.view2 texts.notificationTable
model.listModel
model.items
)
]

View File

@ -40,6 +40,7 @@ import Html.Events exposing (onCheck, onClick, onInput)
import Http
import Markdown
import Messages.LanguageData
import Messages.ScanMailboxFormComp exposing (Texts)
import Set exposing (Set)
import Styles as S
import Util.Folder exposing (mkFolderOption)
@ -98,6 +99,30 @@ type MenuTab
| TabSchedule
{-| Only exits to be able to put tabs in a Set.
-}
tabName : MenuTab -> String
tabName tab =
case tab of
TabGeneral ->
"general"
TabProcessing ->
"processing"
TabAdditionalFilter ->
"additional-filter"
TabPostProcessing ->
"post-processing"
TabMetadata ->
"metadata"
TabSchedule ->
"schedule"
type Msg
= Submit
| Cancel
@ -218,7 +243,7 @@ init flags =
, language = Nothing
, postHandleAll = False
, summary = Nothing
, openTabs = Set.insert (tabTitle TabGeneral) Set.empty
, openTabs = Set.singleton (tabName TabGeneral)
}
, Cmd.batch
[ Api.getImapSettings flags "" ConnResp
@ -662,14 +687,14 @@ update flags msg model =
, Cmd.none
)
ToggleAkkordionTab title ->
ToggleAkkordionTab name ->
let
tabs =
if Set.member title model.openTabs then
Set.remove title model.openTabs
if Set.member name model.openTabs then
Set.remove name model.openTabs
else
Set.insert title model.openTabs
Set.insert name model.openTabs
in
( { model | openTabs = tabs }
, NoAction
@ -711,26 +736,26 @@ isFolderMember model =
Util.Folder.isFolderMember model.allFolders selected
view2 : Flags -> String -> UiSettings -> Model -> Html Msg
view2 flags extraClasses settings model =
view2 : Texts -> Flags -> String -> UiSettings -> Model -> Html Msg
view2 texts flags extraClasses settings model =
let
dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this scan mailbox task?"
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTask
startOnceBtn =
MB.SecondaryButton
{ tagger = StartOnce
, label = "Start Once"
, title = "Start this task now"
, label = texts.startOnce
, title = texts.startNow
, icon = Just "fa fa-play"
}
tabActive t =
if Set.member t.title model.openTabs then
( Comp.Tabs.Open, ToggleAkkordionTab t.title )
if Set.member t.name model.openTabs then
( Comp.Tabs.Open, ToggleAkkordionTab t.name )
else
( Comp.Tabs.Closed, ToggleAkkordionTab t.title )
( Comp.Tabs.Closed, ToggleAkkordionTab t.name )
in
div
[ class extraClasses
@ -740,14 +765,14 @@ view2 flags extraClasses settings model =
{ start =
[ MB.PrimaryButton
{ tagger = Submit
, label = "Submit"
, title = "Save"
, label = texts.basics.submit
, title = texts.basics.submitThisForm
, icon = Just "fa fa-save"
}
, MB.SecondaryButton
{ tagger = Cancel
, label = "Cancel"
, title = "Back to list"
, label = texts.basics.cancel
, title = texts.basics.backToList
, icon = Just "fa fa-arrow-left"
}
]
@ -756,8 +781,8 @@ view2 flags extraClasses settings model =
[ startOnceBtn
, MB.DeleteButton
{ tagger = RequestDelete
, label = "Delete"
, title = "Delete this task"
, label = texts.basics.delete
, title = texts.deleteThisTask
, icon = Just "fa fa-trash"
}
]
@ -781,7 +806,7 @@ view2 flags extraClasses settings model =
, Comp.Tabs.akkordion
Comp.Tabs.defaultStyle
tabActive
(formTabs flags settings model)
(formTabs texts flags settings model)
, Html.map YesNoDeleteMsg
(Comp.YesNoDimmer.viewN
True
@ -792,69 +817,53 @@ view2 flags extraClasses settings model =
]
tabTitle : MenuTab -> String
tabTitle tab =
case tab of
TabGeneral ->
"General"
TabProcessing ->
"Processing"
TabAdditionalFilter ->
"Additional Filter"
TabPostProcessing ->
"Post Processing"
TabMetadata ->
"Metadata"
TabSchedule ->
"Schedule"
formTabs : Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
formTabs flags settings model =
[ { title = tabTitle TabGeneral
formTabs : Texts -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
formTabs texts flags settings model =
[ { name = tabName TabGeneral
, title = texts.generalTab
, titleRight = []
, info = Nothing
, body = viewGeneral2 settings model
, body = viewGeneral2 texts settings model
}
, { title = tabTitle TabProcessing
, { name = tabName TabProcessing
, title = texts.processingTab
, titleRight = []
, info = Just "These settings define which mails are fetched from the mail server."
, body = viewProcessing2 model
, info = Just texts.processingTabInfo
, body = viewProcessing2 texts model
}
, { title = tabTitle TabAdditionalFilter
, { name = tabName TabAdditionalFilter
, title = texts.additionalFilterTab
, titleRight = []
, info = Just "These filters are applied to mails that have been fetched from the mailbox to select those that should be imported."
, body = viewAdditionalFilter2 model
, info = Just texts.additionalFilterTabInfo
, body = viewAdditionalFilter2 texts model
}
, { title = tabTitle TabPostProcessing
, { name = tabName TabPostProcessing
, title = texts.postProcessingTab
, titleRight = []
, info = Just "This defines what happens to mails that have been downloaded."
, body = viewPostProcessing2 model
, info = Just texts.postProcessingTabInfo
, body = viewPostProcessing2 texts model
}
, { title = tabTitle TabMetadata
, { name = tabName TabMetadata
, title = texts.metadataTab
, titleRight = []
, info = Just "Define metadata that should be attached to all items created by this task."
, body = viewMetadata2 flags settings model
, info = Just texts.metadataTabInfo
, body = viewMetadata2 texts flags settings model
}
, { title = tabTitle TabSchedule
, { name = tabName TabSchedule
, title = texts.scheduleTab
, titleRight = []
, info = Just "Define when mails should be imported."
, body = viewSchedule2 model
, info = Just texts.scheduleTabInfo
, body = viewSchedule2 texts model
}
]
viewGeneral2 : UiSettings -> Model -> List (Html Msg)
viewGeneral2 settings model =
viewGeneral2 : Texts -> UiSettings -> Model -> List (Html Msg)
viewGeneral2 texts settings model =
let
connectionCfg =
{ makeOption = \a -> { text = a, additional = "" }
, placeholder = "Select connection..."
, placeholder = texts.selectConnection
, labelColor = \_ -> \_ -> ""
, style = DS.mainStyle
}
@ -864,16 +873,16 @@ viewGeneral2 settings model =
{ id = "scanmail-enabled"
, value = model.enabled
, tagger = \_ -> ToggleEnabled
, label = "Enable or disable this task."
, label = texts.enableDisable
}
, div [ class "mb-4 mt-4" ]
[ label [ class S.inputLabel ]
[ text "Mailbox"
[ text texts.mailbox
, B.inputRequired
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Summary"
[ text texts.summary
]
, input
[ type_ "text"
@ -884,7 +893,7 @@ viewGeneral2 settings model =
]
[]
, span [ class "opacity-50 text-sm" ]
[ text "Some human readable name, only for displaying"
[ text texts.summaryInfo
]
]
, Html.map ConnMsg
@ -894,17 +903,17 @@ viewGeneral2 settings model =
model.connectionModel
)
, span [ class "opacity-50 text-sm" ]
[ text "The IMAP connection to use when sending notification mails."
[ text texts.connectionInfo
]
]
]
viewProcessing2 : Model -> List (Html Msg)
viewProcessing2 model =
viewProcessing2 : Texts -> Model -> List (Html Msg)
viewProcessing2 texts model =
[ div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Folders"
[ text texts.folders
, B.inputRequired
]
, Html.map FoldersMsg
@ -913,12 +922,12 @@ viewProcessing2 model =
model.foldersModel
)
, span [ class "opacity-50 text-sm mt-1" ]
[ text "The folders to look for mails."
[ text texts.foldersInfo
]
]
, Html.map ReceivedHoursMsg
(Comp.IntField.viewWithInfo2
"Select mails newer than `now - receivedHours`"
texts.receivedHoursInfo
model.receivedHours
"mb-4"
model.receivedHoursModel
@ -926,19 +935,19 @@ viewProcessing2 model =
]
viewAdditionalFilter2 : Model -> List (Html Msg)
viewAdditionalFilter2 model =
viewAdditionalFilter2 : Texts -> Model -> List (Html Msg)
viewAdditionalFilter2 texts model =
[ div
[ class "mb-4"
]
[ label
[ class S.inputLabel
]
[ text "File Filter" ]
[ text texts.fileFilter ]
, input
[ type_ "text"
, onInput SetFileFilter
, placeholder "File Filter"
, placeholder texts.fileFilter
, model.fileFilter
|> Maybe.withDefault ""
|> value
@ -946,34 +955,18 @@ viewAdditionalFilter2 model =
]
[]
, div [ class "opacity-50 text-sm" ]
[ text "Specify a file glob to filter attachments. For example, to only extract pdf files: "
, code [ class "font-mono" ]
[ text "*.pdf"
]
, text ". If you want to include the mail body, allow html files or "
, code [ class "font-mono" ]
[ text "mail.html"
]
, text ". Globs can be combined via OR, like this: "
, code [ class "font-mono" ]
[ text "*.pdf|mail.html"
]
, text ". No file filter defaults to "
, code [ class "font-mono" ]
[ text "*"
]
, text " that includes all"
[ Markdown.toHtml [] texts.fileFilterInfo
]
]
, div
[ class "mb-4"
]
[ label [ class S.inputLabel ]
[ text "Subject Filter" ]
[ text texts.subjectFilter ]
, input
[ type_ "text"
, onInput SetSubjectFilter
, placeholder "Subject Filter"
, placeholder texts.subjectFilter
, model.subjectFilter
|> Maybe.withDefault ""
|> value
@ -981,40 +974,29 @@ viewAdditionalFilter2 model =
]
[]
, div [ class "opacity-50 text-sm" ]
[ text "Specify a file glob to filter mails by subject. For example: "
, code [ class "font-mono" ]
[ text "*Scanned Document*"
]
, text ". No file filter defaults to "
, code [ class "font-mono" ]
[ text "*"
]
, text " that includes all"
[ Markdown.toHtml [] texts.subjectFilterInfo
]
]
]
viewPostProcessing2 : Model -> List (Html Msg)
viewPostProcessing2 model =
viewPostProcessing2 : Texts -> Model -> List (Html Msg)
viewPostProcessing2 texts model =
[ div [ class "mb-4" ]
[ MB.viewItem <|
MB.Checkbox
{ id = "scanmail-posthandle-all"
, value = model.postHandleAll
, label = "Apply post-processing to all fetched mails."
, label = texts.postProcessingLabel
, tagger = \_ -> TogglePostHandleAll
}
, span [ class "opacity-50 text-sm mt-1" ]
[ text "When mails are fetched but not imported due to the 'Additional Filters', this flag can "
, text "control whether they should be moved to a target folder or deleted (whatever is "
, text "defined here) nevertheless. If unchecked only imported mails "
, text "are post-processed, others stay where they are."
[ Markdown.toHtml [] texts.postProcessingInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Target folder"
[ text texts.targetFolder
]
, input
[ type_ "text"
@ -1024,28 +1006,26 @@ viewPostProcessing2 model =
]
[]
, span [ class "opacity-50 text-sm" ]
[ text "Move mails into this folder."
[ text texts.targetFolderInfo
]
]
, div [ class "mb-4" ]
[ MB.viewItem <|
MB.Checkbox
{ id = "scanmail-delete-all"
, label = "Delete imported mails"
, label = texts.deleteMailLabel
, tagger = \_ -> ToggleDeleteMail
, value = model.deleteMail
}
, span [ class "opacity-50 text-sm" ]
[ text "Whether to delete all mails fetched by docspell. This only applies if "
, em [] [ text "target folder" ]
, text " is not set."
[ Markdown.toHtml [] texts.deleteMailInfo
]
]
]
viewMetadata2 : Flags -> UiSettings -> Model -> List (Html Msg)
viewMetadata2 flags settings model =
viewMetadata2 : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewMetadata2 texts flags settings model =
let
folderCfg =
{ makeOption = Util.Folder.mkFolderOption flags model.allFolders
@ -1062,7 +1042,7 @@ viewMetadata2 flags settings model =
in
[ div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Item direction"
[ text texts.itemDirection
, B.inputRequired
]
, div [ class "flex flex-col " ]
@ -1074,7 +1054,7 @@ viewMetadata2 flags settings model =
, class S.radioInput
]
[]
, span [ class "ml-2" ] [ text "Automatic" ]
, span [ class "ml-2" ] [ text texts.automatic ]
]
, label [ class "inline-flex items-center" ]
[ input
@ -1084,7 +1064,7 @@ viewMetadata2 flags settings model =
, onCheck (\_ -> DirectionMsg (Just Incoming))
]
[]
, span [ class "ml-2" ] [ text "Incoming" ]
, span [ class "ml-2" ] [ text texts.basics.incoming ]
]
, label [ class "inline-flex items-center" ]
[ input
@ -1094,18 +1074,16 @@ viewMetadata2 flags settings model =
, class S.radioInput
]
[]
, span [ class "ml-2" ] [ text "Outgoing" ]
, span [ class "ml-2" ] [ text texts.basics.outgoing ]
]
, span [ class "opacity-50 text-sm" ]
[ text "Sets the direction for an item. If you know all mails are incoming or "
, text "outgoing, you can set it here. Otherwise it will be guessed from looking "
, text "at sender and receiver."
[ Markdown.toHtml [] texts.itemDirectionInfo
]
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Item Folder"
[ text texts.itemFolder
]
, Html.map FolderDropdownMsg
(Comp.Dropdown.view2
@ -1114,7 +1092,7 @@ viewMetadata2 flags settings model =
model.folderModel
)
, span [ class "opacity-50 text-sm" ]
[ text "Put all items from this mailbox into the selected folder"
[ text texts.itemFolderInfo
]
, div
[ classList
@ -1122,17 +1100,12 @@ viewMetadata2 flags settings model =
]
, class S.message
]
[ Markdown.toHtml [] """
You are **not a member** of this folder. Items created from mails in
this mailbox will be **hidden** from any search results. Use a folder
where you are a member of to make items visible. This message will
disappear then.
"""
[ Markdown.toHtml [] texts.folderOwnerWarning
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Tags" ]
[ text texts.basics.tags ]
, Html.map TagDropdownMsg
(Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle)
@ -1140,12 +1113,12 @@ disappear then.
model.tagModel
)
, div [ class "opacity-50 text-sm" ]
[ text "Choose tags that should be applied to items."
[ text texts.tagsInfo
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Language"
[ text texts.documentLanguage
]
, div [ class "flex flex-row" ]
[ Html.map LanguageMsg
@ -1165,18 +1138,17 @@ disappear then.
]
]
, div [ class "opacity-50 text-sm" ]
[ text "Used for text extraction and text analysis. The "
, text "collective's default language is used, if not specified here."
[ text texts.documentLanguageInfo
]
]
]
viewSchedule2 : Model -> List (Html Msg)
viewSchedule2 model =
viewSchedule2 : Texts -> Model -> List (Html Msg)
viewSchedule2 texts model =
[ div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text "Schedule"
[ text texts.schedule
, B.inputRequired
, a
[ class "float-right"
@ -1186,7 +1158,7 @@ viewSchedule2 model =
]
[ i [ class "fa fa-question" ] []
, span [ class "ml-2" ]
[ text "Click here for help"
[ text texts.scheduleClickForHelp
]
]
]
@ -1196,10 +1168,7 @@ viewSchedule2 model =
model.scheduleModel
)
, span [ class "opacity-50 text-sm" ]
[ text "Specify how often and when this task should run. "
, text "Use English 3-letter weekdays. Either a single value, "
, text "a list (ex. 1,2,3), a range (ex. 1..3) or a '*' (meaning all) "
, text "is allowed for each part."
[ Markdown.toHtml [] texts.scheduleInfo
]
]
]

View File

@ -11,6 +11,7 @@ import Api.Model.ScanMailboxSettings exposing (ScanMailboxSettings)
import Comp.Basic as B
import Html exposing (..)
import Html.Attributes exposing (..)
import Messages.ScanMailboxTableComp exposing (Texts)
import Styles as S
import Util.Html
@ -44,8 +45,8 @@ update msg model =
--- View2
view2 : Model -> List ScanMailboxSettings -> Html Msg
view2 _ items =
view2 : Texts -> Model -> List ScanMailboxSettings -> Html Msg
view2 texts _ items =
div []
[ table [ class S.tableMain ]
[ thead []
@ -54,11 +55,11 @@ view2 _ items =
, th [ class "" ]
[ i [ class "fa fa-check" ] []
]
, th [ class "text-left" ] [ text "Summary" ]
, th [ class "text-left" ] [ text texts.summary ]
, th [ class "text-left mr-2" ] [ text "Schedule" ]
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Connection" ]
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Folders" ]
, th [ class "text-left mr-2 hidden lg:table-cell" ] [ text "Received Since" ]
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text texts.connection ]
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text texts.folders ]
, th [ class "text-left mr-2 hidden lg:table-cell" ] [ text texts.receivedSince ]
]
]
, tbody []

View File

@ -18,6 +18,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Http
import Messages.ScanMailboxManageComp exposing (Texts)
import Styles as S
import Util.Http
@ -212,8 +213,8 @@ update flags msg model =
--- View2
view2 : Flags -> UiSettings -> Model -> Html Msg
view2 flags settings model =
view2 : Texts -> Flags -> UiSettings -> Model -> Html Msg
view2 texts flags settings model =
div [ class "flex flex-col" ]
(div
[ classList
@ -228,34 +229,38 @@ view2 flags settings model =
]
:: (case model.detailModel of
Just msett ->
viewForm2 flags settings msett
viewForm2 texts flags settings msett
Nothing ->
viewList2 model
viewList2 texts model
)
)
viewForm2 : Flags -> UiSettings -> Comp.ScanMailboxForm.Model -> List (Html Msg)
viewForm2 flags settings model =
viewForm2 : Texts -> Flags -> UiSettings -> Comp.ScanMailboxForm.Model -> List (Html Msg)
viewForm2 texts flags settings model =
[ Html.map DetailMsg
(Comp.ScanMailboxForm.view2 flags "" settings model)
(Comp.ScanMailboxForm.view2 texts.form flags "" settings model)
]
viewList2 : Model -> List (Html Msg)
viewList2 model =
viewList2 : Texts -> Model -> List (Html Msg)
viewList2 texts model =
[ MB.view
{ start =
[ MB.PrimaryButton
{ tagger = NewTask
, label = "New Task"
, label = texts.newTask
, icon = Just "fa fa-plus"
, title = "Create a new scan mailbox task"
, title = texts.createNewTask
}
]
, end = []
, rootClasses = "mb-4"
}
, Html.map ListMsg (Comp.ScanMailboxList.view2 model.listModel model.items)
, Html.map ListMsg
(Comp.ScanMailboxList.view2 texts.table
model.listModel
model.items
)
]

View File

@ -936,6 +936,97 @@ viewDrop2 ddd flags settings model =
(searchTabs ddd flags settings model)
type SearchTab
= TabInbox
| TabTags
| TabTagCategories
| TabFolder
| TabCorrespondent
| TabConcerning
| TabCustomFields
| TabDate
| TabDueDate
| TabSource
| TabDirection
tabName : SearchTab -> String
tabName tab =
case tab of
TabInbox ->
"inbox"
TabTags ->
"tags"
TabTagCategories ->
"categories"
TabFolder ->
"folder"
TabCorrespondent ->
"correspondent"
TabConcerning ->
"concerning"
TabCustomFields ->
"custom-fields"
TabDate ->
"date"
TabDueDate ->
"due-date"
TabSource ->
"source"
TabDirection ->
"direction"
findTab : Comp.Tabs.Tab msg -> Maybe SearchTab
findTab tab =
case tab.name of
"inbox" ->
Just TabInbox
"tags" ->
Just TabTags
"categories" ->
Just TabTagCategories
"folder" ->
Just TabFolder
"correspondent" ->
Just TabCorrespondent
"concerning" ->
Just TabConcerning
"custom-fields" ->
Just TabCustomFields
"date" ->
Just TabDate
"due-date" ->
Just TabDueDate
"source" ->
Just TabSource
"direction" ->
Just TabDirection
_ ->
Nothing
searchTabState : UiSettings -> Model -> Comp.Tabs.Tab Msg -> ( Comp.Tabs.State, Msg )
searchTabState settings model tab =
let
@ -943,52 +1034,55 @@ searchTabState settings model tab =
Data.UiSettings.fieldHidden settings f
hidden =
case tab.title of
"Tags" ->
case findTab tab of
Just TabTags ->
isHidden Data.Fields.Tag
"Tag Categories" ->
Just TabTagCategories ->
isHidden Data.Fields.Tag
"Folder" ->
Just TabFolder ->
isHidden Data.Fields.Folder
"Correspondent" ->
Just TabCorrespondent ->
isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson
"Concerning" ->
Just TabConcerning ->
isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson
"Custom Fields" ->
Just TabCustomFields ->
isHidden Data.Fields.CustomFields
|| Comp.CustomFieldMultiInput.isEmpty model.customFieldModel
"Date" ->
Just TabDate ->
isHidden Data.Fields.Date
"Due Date" ->
Just TabDueDate ->
isHidden Data.Fields.DueDate
"Source" ->
Just TabSource ->
isHidden Data.Fields.SourceName
"Direction" ->
Just TabDirection ->
isHidden Data.Fields.Direction
_ ->
Just TabInbox ->
False
Nothing ->
False
state =
if hidden then
Comp.Tabs.Hidden
else if Set.member tab.title model.openTabs then
else if Set.member tab.name model.openTabs then
Comp.Tabs.Open
else
Comp.Tabs.Closed
in
( state, ToggleAkkordionTab tab.title )
( state, ToggleAkkordionTab tab.name )
searchTabs : DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
@ -1032,7 +1126,8 @@ searchTabs ddd flags settings model =
, style = DS.sidebarStyle
}
in
[ { title = "Inbox"
[ { name = tabName TabInbox
, title = "Inbox"
, info = Nothing
, titleRight = []
, body =
@ -1091,7 +1186,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Tags"
, { name = tabName TabTags
, title = "Tags"
, titleRight = []
, info = Nothing
, body =
@ -1103,7 +1199,8 @@ searchTabs ddd flags settings model =
model.tagSelectModel
)
}
, { title = "Tag Categories"
, { name = tabName TabTagCategories
, title = "Tag Categories"
, titleRight = []
, info = Nothing
, body =
@ -1115,7 +1212,8 @@ searchTabs ddd flags settings model =
)
]
}
, { title = "Folder"
, { name = tabName TabFolder
, title = "Folder"
, titleRight = []
, info = Nothing
, body =
@ -1126,7 +1224,8 @@ searchTabs ddd flags settings model =
)
]
}
, { title = "Correspondent"
, { name = tabName TabCorrespondent
, title = "Correspondent"
, titleRight = []
, info = Nothing
, body =
@ -1157,7 +1256,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Concerning"
, { name = tabName TabConcerning
, title = "Concerning"
, titleRight = []
, info = Nothing
, body =
@ -1187,7 +1287,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Custom Fields"
, { name = tabName TabCustomFields
, title = "Custom Fields"
, titleRight = []
, info = Nothing
, body =
@ -1199,7 +1300,8 @@ searchTabs ddd flags settings model =
)
]
}
, { title = "Date"
, { name = tabName TabDate
, title = "Date"
, titleRight = []
, info = Nothing
, body =
@ -1238,7 +1340,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Due Date"
, { name = tabName TabDueDate
, title = "Due Date"
, titleRight = []
, info = Nothing
, body =
@ -1281,7 +1384,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Source"
, { name = tabName TabSource
, title = "Source"
, titleRight = []
, info = Nothing
, body =
@ -1298,7 +1402,8 @@ searchTabs ddd flags settings model =
]
]
}
, { title = "Direction"
, { name = tabName TabDirection
, title = "Direction"
, titleRight = []
, info = Nothing
, body =

View File

@ -11,11 +11,11 @@ module Comp.Tabs exposing
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Styles as S
type alias Tab msg =
{ title : String
{ name : String
, title : String
, titleRight : List (Html msg)
, info : Maybe String
, body : List (Html msg)
@ -79,7 +79,7 @@ akkordionTab style state toggle tab =
[ class "flex flex-row"
, class style.titleClasses
]
([ a
(a
[ class "flex flex-row items-center flex-grow"
, href "#"
, onClick toggle
@ -100,8 +100,7 @@ akkordionTab style state toggle tab =
]
]
]
]
++ tab.titleRight
:: tab.titleRight
)
tabContent =

View File

@ -413,14 +413,14 @@ update sett msg model =
, Just { sett | searchStatsVisible = flag }
)
ToggleAkkordionTab title ->
ToggleAkkordionTab name ->
let
tabs =
if Set.member title model.openTabs then
Set.remove title model.openTabs
if Set.member name model.openTabs then
Set.remove name model.openTabs
else
Set.insert title model.openTabs
Set.insert name model.openTabs
in
( { model | openTabs = tabs }
, Nothing
@ -489,7 +489,7 @@ view2 texts flags settings model =
div [ class "flex flex-col" ]
[ Comp.Tabs.akkordion
Comp.Tabs.defaultStyle
(\t -> ( state t, ToggleAkkordionTab t.title ))
(\t -> ( state t, ToggleAkkordionTab t.name ))
(settingFormTabs texts flags settings model)
]
@ -503,7 +503,8 @@ settingFormTabs texts flags _ model =
, style = DS.mainStyle
}
in
[ { title = texts.general
[ { name = "general"
, title = texts.general
, titleRight = []
, info = Nothing
, body =
@ -528,7 +529,8 @@ settingFormTabs texts flags _ model =
]
]
}
, { title = texts.itemSearch
, { name = "item-search"
, title = texts.itemSearch
, titleRight = []
, info = Nothing
, body =
@ -559,7 +561,8 @@ settingFormTabs texts flags _ model =
]
]
}
, { title = texts.itemCards
, { name = "item-cards"
, title = texts.itemCards
, titleRight = []
, info = Nothing
, body =
@ -627,7 +630,8 @@ settingFormTabs texts flags _ model =
IT.helpMessage
]
}
, { title = texts.searchMenu
, { name = "search-menu"
, title = texts.searchMenu
, titleRight = []
, info = Nothing
, body =
@ -654,7 +658,8 @@ settingFormTabs texts flags _ model =
)
]
}
, { title = texts.itemDetail
, { name = "item-detail"
, title = texts.itemDetail
, titleRight = []
, info = Nothing
, body =
@ -678,7 +683,8 @@ settingFormTabs texts flags _ model =
]
]
}
, { title = texts.tagCategoryColors
, { name = "tag-category-colors"
, title = texts.tagCategoryColors
, titleRight = []
, info = Nothing
, body =
@ -690,7 +696,8 @@ settingFormTabs texts flags _ model =
)
]
}
, { title = texts.fields
, { name = "fields"
, title = texts.fields
, titleRight = []
, info = Nothing
, body =

View File

@ -2,7 +2,6 @@ module Data.SSLType exposing
( SSLType(..)
, all
, fromString
, label
, toString
)
@ -45,16 +44,3 @@ fromString str =
_ ->
Nothing
label : SSLType -> String
label st =
case st of
None ->
"None"
SSL ->
"SSL/TLS"
StartTLS ->
"StartTLS"

View File

@ -0,0 +1,45 @@
module Messages.EmailSettingsFormComp exposing (..)
import Data.SSLType exposing (SSLType)
import Messages.SSLTypeData
type alias Texts =
{ sslTypeLabel : SSLType -> String
, name : String
, connectionPlaceholder : String
, connectionNameInfo : String
, smtpHost : String
, smtpHostPlaceholder : String
, smtpUser : String
, smtpUserPlaceholder : String
, smtpPassword : String
, smtpPasswordPlaceholder : String
, fromAddress : String
, fromAddressPlaceholder : String
, replyTo : String
, replyToPlaceholder : String
, ssl : String
, ignoreCertCheck : String
}
gb : Texts
gb =
{ sslTypeLabel = Messages.SSLTypeData.gb
, name = "Name"
, connectionPlaceholder = "Connection name, e.g. 'gmail.com'"
, connectionNameInfo = "The connection name must not contain whitespace or special characters."
, smtpHost = "SMTP Host"
, smtpHostPlaceholder = "SMTP host name, e.g. 'mail.gmail.com'"
, smtpUser = "SMTP User"
, smtpUserPlaceholder = "SMTP Username, e.g. 'your.name@gmail.com'"
, smtpPassword = "SMTP Password"
, smtpPasswordPlaceholder = "Password"
, fromAddress = "From Address"
, fromAddressPlaceholder = "Sender E-Mail address"
, replyTo = "Reply-To"
, replyToPlaceholder = "Optional reply-to E-Mail address"
, ssl = "SSL"
, ignoreCertCheck = "Ignore certificate check"
}

View File

@ -0,0 +1,28 @@
module Messages.EmailSettingsManageComp exposing (..)
import Messages.Basics
import Messages.EmailSettingsFormComp
import Messages.EmailSettingsTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, settingsForm : Messages.EmailSettingsFormComp.Texts
, settingsTable : Messages.EmailSettingsTableComp.Texts
, newSettings : String
, addNewSmtpSettings : String
, reallyDeleteConnection : String
, deleteThisEntry : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, settingsForm = Messages.EmailSettingsFormComp.gb
, settingsTable = Messages.EmailSettingsTableComp.gb
, newSettings = "New Settings"
, addNewSmtpSettings = "Add new SMTP settings"
, reallyDeleteConnection = "Really delete these connection?"
, deleteThisEntry = "Delete this connection"
}

View File

@ -0,0 +1,16 @@
module Messages.EmailSettingsTableComp exposing (..)
type alias Texts =
{ name : String
, hostPort : String
, from : String
}
gb : Texts
gb =
{ name = "Name"
, hostPort = "Host/Port"
, from = "From"
}

View File

@ -0,0 +1,41 @@
module Messages.ImapSettingsFormComp exposing (..)
import Data.SSLType exposing (SSLType)
import Messages.SSLTypeData
type alias Texts =
{ sslTypeLabel : SSLType -> String
, name : String
, connectionNamePlaceholder : String
, connectionNameInfo : String
, imapHost : String
, imapHostPlaceholder : String
, imapUser : String
, imapUserPlaceholder : String
, imapPassword : String
, imapPasswordPlaceholder : String
, ssl : String
, ignoreCertCheck : String
, enableOAuth2 : String
, oauth2Info : String
}
gb : Texts
gb =
{ sslTypeLabel = Messages.SSLTypeData.gb
, name = "Name"
, connectionNamePlaceholder = "Connection name, e.g. 'gmail.com'"
, connectionNameInfo = "The connection name must not contain whitespace or special characters."
, imapHost = "IMAP Host"
, imapHostPlaceholder = "IMAP host name, e.g. 'mail.gmail.com'"
, imapUser = "IMAP User"
, imapUserPlaceholder = "IMAP Username, e.g. 'your.name@gmail.com'"
, imapPassword = "IMAP Password"
, imapPasswordPlaceholder = "Password"
, ssl = "SSL"
, ignoreCertCheck = "Ignore certificate check"
, enableOAuth2 = "Enable OAuth2 authentication"
, oauth2Info = "Enabling this, allows to connect via XOAuth using the password as access token."
}

View File

@ -0,0 +1,28 @@
module Messages.ImapSettingsManageComp exposing (..)
import Messages.Basics
import Messages.ImapSettingsFormComp
import Messages.ImapSettingsTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, imapForm : Messages.ImapSettingsFormComp.Texts
, imapTable : Messages.ImapSettingsTableComp.Texts
, addNewImapSettings : String
, newSettings : String
, reallyDeleteSettings : String
, deleteThisEntry : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, imapForm = Messages.ImapSettingsFormComp.gb
, imapTable = Messages.ImapSettingsTableComp.gb
, addNewImapSettings = "Add new IMAP settings"
, newSettings = "New Settings"
, reallyDeleteSettings = "Really delete this mail-box connection?"
, deleteThisEntry = "Delete this settings entry"
}

View File

@ -0,0 +1,14 @@
module Messages.ImapSettingsTableComp exposing (..)
type alias Texts =
{ name : String
, hostPort : String
}
gb : Texts
gb =
{ name = "Name"
, hostPort = "Host/Port"
}

View File

@ -0,0 +1,62 @@
module Messages.NotificationFormComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, reallyDeleteTask : String
, startOnce : String
, startTaskNow : String
, selectConnection : String
, deleteThisTask : String
, enableDisable : String
, summary : String
, summaryInfo : String
, sendVia : String
, sendViaInfo : String
, recipients : String
, recipientsInfo : String
, tagsInclude : String
, tagsIncludeInfo : String
, tagsExclude : String
, tagsExcludeInfo : String
, remindDaysInfo : String
, capOverdue : String
, capOverdueInfo : String
, schedule : String
, scheduleClickForHelp : String
, scheduleInfo : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, reallyDeleteTask = "Really delete this notification task?"
, startOnce = "Start Once"
, startTaskNow = "Start this task now"
, selectConnection = "Select connection..."
, deleteThisTask = "Delete this task"
, enableDisable = "Enable or disable this task."
, summary = "Summary"
, summaryInfo = "Some human readable name, only for displaying"
, sendVia = "Send via"
, sendViaInfo = "The SMTP connection to use when sending notification mails."
, recipients = "Recipient(s)"
, recipientsInfo = "One or more mail addresses, confirm each by pressing 'Return'."
, tagsInclude = "Tags Include (and)"
, tagsIncludeInfo = "Items must have all the tags specified here."
, tagsExclude = "Tags Exclude (or)"
, tagsExcludeInfo = "Items must not have any tag specified here."
, remindDaysInfo = "Select items with a due date *lower than* `today+remindDays`"
, capOverdue = "Cap overdue items"
, capOverdueInfo = "If checked, only items with a due date *greater than* `today - remindDays` are considered."
, schedule = "Schedule"
, scheduleClickForHelp = "Click here for help"
, scheduleInfo =
"Specify how often and when this task should run. "
++ "Use English 3-letter weekdays. Either a single value, "
++ "a list (ex. 1,2,3), a range (ex. 1..3) or a '*' (meaning all) "
++ "is allowed for each part."
}

View File

@ -0,0 +1,24 @@
module Messages.NotificationManageComp exposing (..)
import Messages.Basics
import Messages.NotificationFormComp
import Messages.NotificationTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, notificationForm : Messages.NotificationFormComp.Texts
, notificationTable : Messages.NotificationTableComp.Texts
, newTask : String
, createNewTask : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, notificationForm = Messages.NotificationFormComp.gb
, notificationTable = Messages.NotificationTableComp.gb
, newTask = "New Task"
, createNewTask = "Create a new notification task"
}

View File

@ -0,0 +1,18 @@
module Messages.NotificationTableComp exposing (..)
type alias Texts =
{ summary : String
, schedule : String
, connection : String
, recipients : String
}
gb : Texts
gb =
{ summary = "Summary"
, schedule = "Schedule"
, connection = "Connection"
, recipients = "Recipients"
}

View File

@ -0,0 +1,16 @@
module Messages.SSLTypeData exposing (..)
import Data.SSLType exposing (SSLType(..))
gb : SSLType -> String
gb st =
case st of
None ->
"None"
SSL ->
"SSL/TLS"
StartTLS ->
"StartTLS"

View File

@ -0,0 +1,133 @@
module Messages.ScanMailboxFormComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, reallyDeleteTask : String
, startOnce : String
, startNow : String
, deleteThisTask : String
, generalTab : String
, processingTab : String
, additionalFilterTab : String
, postProcessingTab : String
, metadataTab : String
, scheduleTab : String
, processingTabInfo : String
, additionalFilterTabInfo : String
, postProcessingTabInfo : String
, metadataTabInfo : String
, scheduleTabInfo : String
, selectConnection : String
, enableDisable : String
, mailbox : String
, summary : String
, summaryInfo : String
, connectionInfo : String
, folders : String
, foldersInfo : String
, receivedHoursInfo : String
, fileFilter : String
, fileFilterInfo : String
, subjectFilter : String
, subjectFilterInfo : String
, postProcessingLabel : String
, postProcessingInfo : String
, targetFolder : String
, targetFolderInfo : String
, deleteMailLabel : String
, deleteMailInfo : String
, itemDirection : String
, automatic : String
, itemDirectionInfo : String
, itemFolder : String
, itemFolderInfo : String
, folderOwnerWarning : String
, tagsInfo : String
, documentLanguage : String
, documentLanguageInfo : String
, schedule : String
, scheduleClickForHelp : String
, scheduleInfo : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, reallyDeleteTask = "Really delete this scan mailbox task?"
, startOnce = "Start Once"
, startNow = "Start this task now"
, deleteThisTask = "Delete this task"
, generalTab = "General"
, processingTab = "Processing"
, additionalFilterTab = "Additional Filter"
, postProcessingTab = "Post Processing"
, metadataTab = "Metadata"
, scheduleTab = "Schedule"
, processingTabInfo = "These settings define which mails are fetched from the mail server."
, additionalFilterTabInfo = "These filters are applied to mails that have been fetched from the mailbox to select those that should be imported."
, postProcessingTabInfo = "This defines what happens to mails that have been downloaded."
, metadataTabInfo = "Define metadata that should be attached to all items created by this task."
, scheduleTabInfo = "Define when mails should be imported."
, selectConnection = "Select connection..."
, enableDisable = "Enable or disable this task."
, mailbox = "Mailbox"
, summary = "Summary"
, summaryInfo = "Some human readable name, only for displaying"
, connectionInfo = "The IMAP connection to use when sending notification mails."
, folders = "Folders"
, foldersInfo = "The folders to look for mails."
, receivedHoursInfo = "Select mails newer than `now - receivedHours`"
, fileFilter = "File Filter"
, fileFilterInfo =
"Specify a file glob to filter attachments. For example, to only extract pdf files: "
++ "`*.pdf`. If you want to include the mail body, allow html files or "
++ "`mail.html`. Globs can be combined via OR, like this: "
++ "`*.pdf|mail.html`. No file filter defaults to "
++ "`*` that includes all"
, subjectFilter = "Subject Filter"
, subjectFilterInfo =
"Specify a file glob to filter mails by subject. For example: "
++ "`*Scanned Document*`. No file filter defaults to `*` that includes all."
, postProcessingLabel = "Apply post-processing to all fetched mails."
, postProcessingInfo =
"When mails are fetched but not imported due to the 'Additional Filters', this flag can "
++ "control whether they should be moved to a target folder or deleted (whatever is "
++ "defined here) nevertheless. If unchecked only imported mails "
++ "are post-processed, others stay where they are."
, targetFolder = "Target folder"
, targetFolderInfo = "Move mails into this folder."
, deleteMailLabel = "Delete imported mails"
, deleteMailInfo =
"Whether to delete all mails fetched by docspell. This only applies if "
++ "*target folder* is not set."
, itemDirection = "Item direction"
, automatic = "Automatic"
, itemDirectionInfo =
"Sets the direction for an item. If you know all mails are incoming or "
++ "outgoing, you can set it here. Otherwise it will be guessed from looking "
++ "at sender and receiver."
, itemFolder = "Item Folder"
, itemFolderInfo = "Put all items from this mailbox into the selected folder"
, folderOwnerWarning = """
You are **not a member** of this folder. Items created from mails in
this mailbox will be **hidden** from any search results. Use a folder
where you are a member of to make items visible. This message will
disappear then.
"""
, tagsInfo = "Choose tags that should be applied to items."
, documentLanguage = "Language"
, documentLanguageInfo =
"Used for text extraction and text analysis. The "
++ "collective's default language is used, if not specified here."
, schedule = "Schedule"
, scheduleClickForHelp = "Click here for help"
, scheduleInfo =
"Specify how often and when this task should run. "
++ "Use English 3-letter weekdays. Either a single value, "
++ "a list (ex. 1,2,3), a range (ex. 1..3) or a '*' (meaning all) "
++ "is allowed for each part."
}

View File

@ -0,0 +1,24 @@
module Messages.ScanMailboxManageComp exposing (..)
import Messages.Basics
import Messages.ScanMailboxFormComp
import Messages.ScanMailboxTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, form : Messages.ScanMailboxFormComp.Texts
, table : Messages.ScanMailboxTableComp.Texts
, newTask : String
, createNewTask : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, form = Messages.ScanMailboxFormComp.gb
, table = Messages.ScanMailboxTableComp.gb
, newTask = "New Task"
, createNewTask = "Create a new scan mailbox task"
}

View File

@ -0,0 +1,18 @@
module Messages.ScanMailboxTableComp exposing (..)
type alias Texts =
{ summary : String
, connection : String
, folders : String
, receivedSince : String
}
gb : Texts
gb =
{ summary = "Summary"
, connection = "Connection"
, folders = "Folders"
, receivedSince = "Received Since"
}

View File

@ -1,12 +1,20 @@
module Messages.UserSettingsPage exposing (..)
import Messages.ChangePasswordFormComp
import Messages.EmailSettingsManageComp
import Messages.ImapSettingsManageComp
import Messages.NotificationManageComp
import Messages.ScanMailboxManageComp
import Messages.UiSettingsManageComp
type alias Texts =
{ changePasswordForm : Messages.ChangePasswordFormComp.Texts
, uiSettingsManage : Messages.UiSettingsManageComp.Texts
, emailSettingsManage : Messages.EmailSettingsManageComp.Texts
, imapSettingsManage : Messages.ImapSettingsManageComp.Texts
, notificationManage : Messages.NotificationManageComp.Texts
, scanMailboxManage : Messages.ScanMailboxManageComp.Texts
, userSettings : String
, uiSettings : String
, notifications : String
@ -15,6 +23,10 @@ type alias Texts =
, emailSettingImap : String
, changePassword : String
, uiSettingsInfo : String
, notificationInfoText : String
, notificationRemindDaysInfo : String
, scanMailboxInfo1 : String
, scanMailboxInfo2 : String
}
@ -22,6 +34,10 @@ gb : Texts
gb =
{ changePasswordForm = Messages.ChangePasswordFormComp.gb
, uiSettingsManage = Messages.UiSettingsManageComp.gb
, emailSettingsManage = Messages.EmailSettingsManageComp.gb
, imapSettingsManage = Messages.ImapSettingsManageComp.gb
, notificationManage = Messages.NotificationManageComp.gb
, scanMailboxManage = Messages.ScanMailboxManageComp.gb
, userSettings = "User Settings"
, uiSettings = "UI Settings"
, notifications = "Notifications"
@ -32,6 +48,27 @@ gb =
, uiSettingsInfo =
"These settings only affect the web ui. They are stored in the browser, "
++ "so they are separated between browsers and devices."
, notificationInfoText =
"""
Docspell can notify you once the due dates of your items
come closer. Notification is done via e-mail. You need to
provide a connection in your e-mail settings."""
, notificationRemindDaysInfo =
"Docspell finds all items that are due in *Remind Days* days and sends this list via e-mail."
, scanMailboxInfo1 =
"Docspell can scan folders of your mailbox to import your mails. "
++ "You need to provide a connection in "
++ "your e-mail (imap) settings."
, scanMailboxInfo2 =
"""
Docspell goes through all configured folders and imports
mails matching the search criteria. Mails are skipped if
they were imported in a previous run and the corresponding
items still exist. After submitting a mail into docspell,
you can choose to move it to another folder, to delete it
or to just leave it there. In the latter case you should
adjust the schedule to avoid reading over the same mails
again."""
}

View File

@ -11,6 +11,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Markdown
import Messages.UserSettingsPage exposing (Texts)
import Page.UserSettings.Data exposing (..)
import Styles as S
@ -111,16 +112,16 @@ viewContent texts flags settings model =
viewChangePassword texts model
Just EmailSettingsTab ->
viewEmailSettings settings model
viewEmailSettings texts settings model
Just NotificationTab ->
viewNotificationManage settings model
viewNotificationManage texts settings model
Just ImapSettingsTab ->
viewImapSettings settings model
viewImapSettings texts settings model
Just ScanMailboxTab ->
viewScanMailboxManage flags settings model
viewScanMailboxManage texts flags settings model
Just UiSettingsTab ->
viewUiSettings texts flags settings model
@ -186,100 +187,91 @@ viewUiSettings texts flags settings model =
]
viewEmailSettings : UiSettings -> Model -> List (Html Msg)
viewEmailSettings settings model =
viewEmailSettings : Texts -> UiSettings -> Model -> List (Html Msg)
viewEmailSettings texts settings model =
[ h2
[ class S.header1
, class "inline-flex items-center"
]
[ i [ class "fa fa-envelope" ] []
, div [ class "ml-3" ]
[ text "E-Mail Settings (Smtp)"
[ text texts.emailSettingSmtp
]
]
, Html.map EmailSettingsMsg
(Comp.EmailSettingsManage.view2
texts.emailSettingsManage
settings
model.emailSettingsModel
)
]
viewImapSettings : UiSettings -> Model -> List (Html Msg)
viewImapSettings settings model =
viewImapSettings : Texts -> UiSettings -> Model -> List (Html Msg)
viewImapSettings texts settings model =
[ h2
[ class S.header1
, class "inline-flex items-center"
]
[ i [ class "fa fa-envelope" ] []
, div [ class "ml-3" ]
[ text "E-Mail Settings (Imap)"
[ text texts.emailSettingImap
]
]
, Html.map ImapSettingsMsg
(Comp.ImapSettingsManage.view2
texts.imapSettingsManage
settings
model.imapSettingsModel
)
]
viewNotificationManage : UiSettings -> Model -> List (Html Msg)
viewNotificationManage settings model =
viewNotificationManage : Texts -> UiSettings -> Model -> List (Html Msg)
viewNotificationManage texts settings model =
[ h2
[ class S.header1
, class "inline-flex items-center"
]
[ i [ class "fa fa-bullhorn" ] []
, div [ class "ml-3" ]
[ text "Notification"
[ text texts.notifications
]
]
, p [ class "opacity-80 text-lg mb-3" ]
[ text """
Docspell can notify you once the due dates of your items
come closer. Notification is done via e-mail. You need to
provide a connection in your e-mail settings."""
[ text texts.notificationInfoText
]
, p [ class "opacity-80 text-lg mb-3" ]
[ text "Docspell finds all items that are due in "
, em [ class "font-italic" ] [ text "Remind Days" ]
, text " days and sends this list via e-mail."
[ Markdown.toHtml [] texts.notificationRemindDaysInfo
]
, Html.map NotificationMsg
(Comp.NotificationManage.view2 settings model.notificationModel)
(Comp.NotificationManage.view2 texts.notificationManage
settings
model.notificationModel
)
]
viewScanMailboxManage : Flags -> UiSettings -> Model -> List (Html Msg)
viewScanMailboxManage flags settings model =
viewScanMailboxManage : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewScanMailboxManage texts flags settings model =
[ h2
[ class S.header1
, class "inline-flex items-center"
]
[ i [ class "fa fa-envelope-open font-thin" ] []
, div [ class "ml-3" ]
[ text "Scan Mailbox"
[ text texts.scanMailbox
]
]
, p [ class "opacity-80 text-lg mb-3" ]
[ text "Docspell can scan folders of your mailbox to import your mails. "
, text "You need to provide a connection in "
, text "your e-mail (imap) settings."
[ text texts.scanMailboxInfo1
]
, p [ class "opacity-80 text-lg mb-3 hidden" ]
[ text """
Docspell goes through all configured folders and imports
mails matching the search criteria. Mails are skipped if
they were imported in a previous run and the corresponding
items still exist. After submitting a mail into docspell,
you can choose to move it to another folder, to delete it
or to just leave it there. In the latter case you should
adjust the schedule to avoid reading over the same mails
again."""
[ text texts.scanMailboxInfo2
]
, Html.map ScanMailboxMsg
(Comp.ScanMailboxManage.view2
texts.scanMailboxManage
flags
settings
model.scanMailboxModel