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 module Comp.EmailInput exposing
( Model ( Model
, Msg , Msg
, ViewSettings
, init , init
, update , update
, view2 , view2
@ -137,10 +138,16 @@ update flags current msg model =
--- View2 --- View2
view2 : DS.DropdownStyle -> List String -> Model -> Html Msg type alias ViewSettings =
view2 style values model = { 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 "text-sm flex-row space-x-2 relative" ]
[ div [ class style.link ] [ div [ class cfg.style.link ]
[ div [ div
[ class "flex flex-row space-x-2 mr-2" [ class "flex flex-row space-x-2 mr-2"
, classList [ ( "hidden", List.isEmpty values ) ] , classList [ ( "hidden", List.isEmpty values ) ]
@ -149,7 +156,7 @@ view2 style values model =
, input , input
[ type_ "text" [ type_ "text"
, value model.input , value model.input
, placeholder "Recipients" , placeholder cfg.placeholder
, onKeyUp KeyPress , onKeyUp KeyPress
, onInput SetInput , onInput SetInput
, class "inline-flex w-24 border-0 px-0 focus:ring-0 h-6 text-sm" , 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 exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.EmailSettingsFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -170,13 +171,13 @@ update msg model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
let let
sslCfg = sslCfg =
{ makeOption = { makeOption =
\s -> \s ->
{ text = Data.SSLType.label s { text = texts.sslTypeLabel s
, additional = "" , additional = ""
} }
, placeholder = "" , placeholder = ""
@ -189,14 +190,14 @@ view2 settings model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, value model.name , value model.name
, onInput SetName , onInput SetName
, placeholder "Connection name, e.g. 'gmail.com'" , placeholder texts.connectionPlaceholder
, class S.textInput , class S.textInput
, classList [ ( S.inputErrorBorder, model.name == "" ) ] , classList [ ( S.inputErrorBorder, model.name == "" ) ]
] ]
@ -205,17 +206,17 @@ view2 settings model =
[ class S.message [ class S.message
, class "mt-2" , class "mt-2"
] ]
[ text "The connection name must not contain whitespace or special characters." [ text texts.connectionNameInfo
] ]
] ]
, div [ class "col-span-3" ] , div [ class "col-span-3" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "SMTP Host" [ text texts.smtpHost
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "SMTP host name, e.g. 'mail.gmail.com'" , placeholder texts.smtpHostPlaceholder
, value model.host , value model.host
, onInput SetHost , onInput SetHost
, class S.textInput , class S.textInput
@ -233,11 +234,11 @@ view2 settings model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "SMTP User" [ text texts.smtpUser
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "SMTP Username, e.g. 'your.name@gmail.com'" , placeholder texts.smtpUserPlaceholder
, Maybe.withDefault "" model.user |> value , Maybe.withDefault "" model.user |> value
, onInput SetUser , onInput SetUser
, class S.textInput , class S.textInput
@ -246,11 +247,11 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "SMTP Password" [ text texts.smtpPassword
] ]
, Html.map PassMsg , Html.map PassMsg
(Comp.PasswordInput.view2 (Comp.PasswordInput.view2
{ placeholder = "Password" } { placeholder = texts.smtpPasswordPlaceholder }
model.password model.password
False False
model.passField model.passField
@ -258,12 +259,12 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "From Address" [ text texts.fromAddress
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "Sender E-Mail address" , placeholder texts.fromAddressPlaceholder
, value model.from , value model.from
, onInput SetFrom , onInput SetFrom
, class S.textInput , class S.textInput
@ -273,11 +274,11 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Reply-To" [ text texts.replyTo
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "Optional reply-to E-Mail address" , placeholder texts.replyToPlaceholder
, Maybe.withDefault "" model.replyTo |> value , Maybe.withDefault "" model.replyTo |> value
, onInput SetReplyTo , onInput SetReplyTo
, class S.textInput , class S.textInput
@ -286,7 +287,7 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "SSL" [ text texts.ssl
] ]
, Html.map SSLTypeMsg , Html.map SSLTypeMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
@ -299,7 +300,7 @@ view2 settings model =
[ MB.viewItem <| [ MB.viewItem <|
MB.Checkbox MB.Checkbox
{ tagger = \_ -> ToggleCheckCert { tagger = \_ -> ToggleCheckCert
, label = "Ignore certificate check" , label = texts.ignoreCertCheck
, value = model.ignoreCertificates , value = model.ignoreCertificates
, id = "smpt-no-cert-check" , id = "smpt-no-cert-check"
} }

View File

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

View File

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

View File

@ -21,6 +21,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.ImapSettingsFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -162,13 +163,13 @@ update msg model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
let let
sslCfg = sslCfg =
{ makeOption = { makeOption =
\s -> \s ->
{ text = Data.SSLType.label s { text = texts.sslTypeLabel s
, additional = "" , additional = ""
} }
, placeholder = "" , placeholder = ""
@ -180,14 +181,14 @@ view2 settings model =
[ class "grid grid-cols-4 gap-y-4 gap-x-2" ] [ class "grid grid-cols-4 gap-y-4 gap-x-2" ]
[ div [ class "col-span-4" ] [ div [ class "col-span-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, value model.name , value model.name
, onInput SetName , onInput SetName
, placeholder "Connection name, e.g. 'gmail.com'" , placeholder texts.connectionNamePlaceholder
, class S.textInput , class S.textInput
, classList [ ( S.inputErrorBorder, model.name == "" ) ] , classList [ ( S.inputErrorBorder, model.name == "" ) ]
] ]
@ -196,17 +197,17 @@ view2 settings model =
[ class S.message [ class S.message
, class "mt-2" , class "mt-2"
] ]
[ text "The connection name must not contain whitespace or special characters." [ text texts.connectionNameInfo
] ]
] ]
, div [ class "col-span-3" ] , div [ class "col-span-3" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "IMAP Host" [ text texts.imapHost
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "IMAP host name, e.g. 'mail.gmail.com'" , placeholder texts.imapHostPlaceholder
, value model.host , value model.host
, onInput SetHost , onInput SetHost
, class S.textInput , class S.textInput
@ -222,11 +223,11 @@ view2 settings model =
) )
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "IMAP User" [ text texts.imapUser
] ]
, input , input
[ type_ "text" [ type_ "text"
, placeholder "IMAP Username, e.g. 'your.name@gmail.com'" , placeholder texts.imapUserPlaceholder
, Maybe.withDefault "" model.user |> value , Maybe.withDefault "" model.user |> value
, onInput SetUser , onInput SetUser
, class S.textInput , class S.textInput
@ -235,10 +236,10 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "IMAP Password" ] [ text texts.imapPassword ]
, Html.map PassMsg , Html.map PassMsg
(Comp.PasswordInput.view2 (Comp.PasswordInput.view2
{ placeholder = "Password" } { placeholder = texts.imapPasswordPlaceholder }
model.password model.password
False False
model.passField model.passField
@ -246,7 +247,7 @@ view2 settings model =
] ]
, div [ class "col-span-4 sm:col-span-2" ] , div [ class "col-span-4 sm:col-span-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "SSL" [ text texts.ssl
] ]
, Html.map SSLTypeMsg , Html.map SSLTypeMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
@ -259,7 +260,7 @@ view2 settings model =
[ MB.viewItem <| [ MB.viewItem <|
MB.Checkbox MB.Checkbox
{ tagger = \_ -> ToggleCheckCert { tagger = \_ -> ToggleCheckCert
, label = "Ignore certificate check" , label = texts.ignoreCertCheck
, value = model.ignoreCertificates , value = model.ignoreCertificates
, id = "imap-no-cert-check" , id = "imap-no-cert-check"
} }
@ -268,12 +269,12 @@ view2 settings model =
[ MB.viewItem <| [ MB.viewItem <|
MB.Checkbox MB.Checkbox
{ tagger = \_ -> ToggleUseOAuth { tagger = \_ -> ToggleUseOAuth
, label = "Enable OAuth2 authentication" , label = texts.enableOAuth2
, value = model.useOAuthToken , value = model.useOAuthToken
, id = "imap-use-oauth" , id = "imap-use-oauth"
} }
, div [ class "opacity-50 text-sm" ] , 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 exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Http import Http
import Messages.ImapSettingsManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
@ -206,74 +207,75 @@ update flags msg model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
case model.viewMode of case model.viewMode of
Table -> Table ->
viewTable2 model viewTable2 texts model
Form -> Form ->
viewForm2 settings model viewForm2 texts settings model
viewTable2 : Model -> Html Msg viewTable2 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [] div []
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNew { tagger = InitNew
, title = "Add new SMTP settings" , title = texts.addNewImapSettings
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Settings" , label = texts.newSettings
} }
] ]
, rootClasses = "mb-4" , rootClasses = "mb-4"
} }
, Html.map TableMsg , Html.map TableMsg
(Comp.ImapSettingsTable.view2 (Comp.ImapSettingsTable.view2
texts.imapTable
model.tableModel model.tableModel
) )
] ]
viewForm2 : UiSettings -> Model -> Html Msg viewForm2 : Texts -> UiSettings -> Model -> Html Msg
viewForm2 settings model = viewForm2 texts settings model =
let let
dimmerSettings = dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this mail-box connection?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteSettings
in in
div [ class "flex flex-col md:relative" ] div [ class "flex flex-col md:relative" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = Submit { tagger = Submit
, title = "Submit this form" , title = texts.basics.submitThisForm
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = SetViewMode Table { tagger = SetViewMode Table
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if model.formModel.settings.name /= "" then if model.formModel.settings.name /= "" then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this settings entry" , title = texts.deleteThisEntry
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]
@ -292,6 +294,7 @@ viewForm2 settings model =
] ]
, Html.map FormMsg , Html.map FormMsg
(Comp.ImapSettingsForm.view2 (Comp.ImapSettingsForm.view2
texts.imapForm
settings settings
model.formModel model.formModel
) )

View File

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

View File

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

View File

@ -3,7 +3,7 @@ module Comp.ItemDetail.EditForm exposing (formTabs, view2)
import Comp.CustomFieldMultiInput import Comp.CustomFieldMultiInput
import Comp.DatePicker import Comp.DatePicker
import Comp.Dropdown import Comp.Dropdown
import Comp.ItemDetail.FieldTabState as FTabState import Comp.ItemDetail.FieldTabState as FTabState exposing (EditTab(..))
import Comp.ItemDetail.Model import Comp.ItemDetail.Model
exposing exposing
( Model ( Model
@ -143,7 +143,8 @@ formTabs flags settings model =
, style = dds , style = dds
} }
in in
[ { title = "Name" [ { name = FTabState.tabName TabName
, title = "Name"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -169,7 +170,8 @@ formTabs flags settings model =
] ]
] ]
} }
, { title = "Date" , { name = FTabState.tabName TabDate
, title = "Date"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -194,7 +196,8 @@ formTabs flags settings model =
] ]
] ]
} }
, { title = "Tags" , { name = FTabState.tabName TabTags
, title = "Tags"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -217,7 +220,8 @@ formTabs flags settings model =
] ]
] ]
} }
, { title = "Folder" , { name = FTabState.tabName TabFolder
, title = "Folder"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -243,7 +247,8 @@ item visible. This message will disappear then.
] ]
] ]
} }
, { title = "Custom Fields" , { name = FTabState.tabName TabCustomFields
, title = "Custom Fields"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -257,7 +262,8 @@ item visible. This message will disappear then.
] ]
] ]
} }
, { title = "Due Date" , { name = FTabState.tabName TabDueDate
, title = "Due Date"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -282,7 +288,8 @@ item visible. This message will disappear then.
] ]
] ]
} }
, { title = "Correspondent" , { name = FTabState.tabName TabCorrespondent
, title = "Correspondent"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -331,7 +338,8 @@ item visible. This message will disappear then.
] ]
] ]
} }
, { title = "Concerning" , { name = FTabState.tabName TabConcerning
, title = "Concerning"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -373,7 +381,8 @@ item visible. This message will disappear then.
] ]
] ]
} }
, { title = "Direction" , { name = FTabState.tabName TabDirection
, title = "Direction"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -494,4 +503,4 @@ tabState settings allNames model =
FTabState.tabState settings FTabState.tabState settings
openTabs openTabs
Nothing 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.CustomFieldMultiInput
import Comp.Tabs as TB import Comp.Tabs as TB
@ -7,6 +7,87 @@ import Data.UiSettings exposing (UiSettings)
import Set exposing (Set) 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 : tabState :
UiSettings UiSettings
-> Set String -> Set String
@ -20,32 +101,32 @@ tabState settings openTabs cfmodel toggle tab =
Data.UiSettings.fieldHidden settings f Data.UiSettings.fieldHidden settings f
hidden = hidden =
case tab.title of case findTab tab of
"Tags" -> Just TabTags ->
isHidden Data.Fields.Tag isHidden Data.Fields.Tag
"Folder" -> Just TabFolder ->
isHidden Data.Fields.Folder isHidden Data.Fields.Folder
"Correspondent" -> Just TabCorrespondent ->
isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson
"Concerning" -> Just TabConcerning ->
isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson
"Custom Fields" -> Just TabCustomFields ->
isHidden Data.Fields.CustomFields isHidden Data.Fields.CustomFields
|| (Maybe.map Comp.CustomFieldMultiInput.isEmpty cfmodel || (Maybe.map Comp.CustomFieldMultiInput.isEmpty cfmodel
|> Maybe.withDefault False |> Maybe.withDefault False
) )
"Date" -> Just TabDate ->
isHidden Data.Fields.Date isHidden Data.Fields.Date
"Due Date" -> Just TabDueDate ->
isHidden Data.Fields.DueDate isHidden Data.Fields.DueDate
"Direction" -> Just TabDirection ->
isHidden Data.Fields.Direction isHidden Data.Fields.Direction
_ -> _ ->
@ -55,7 +136,7 @@ tabState settings openTabs cfmodel toggle tab =
if hidden then if hidden then
TB.Hidden TB.Hidden
else if Set.member tab.title openTabs then else if Set.member tab.name openTabs then
TB.Open TB.Open
else else

View File

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

View File

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

View File

@ -255,21 +255,30 @@ view2 settings model =
, B.inputRequired , B.inputRequired
] ]
, Html.map RecipientMsg , 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" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "CC(s)" [ text "CC(s)"
] ]
, Html.map CCRecipientMsg , 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" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "BCC(s)" [ text "BCC(s)"
] ]
, Html.map BCCRecipientMsg , 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" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]

View File

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

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Http import Http
import Messages.ScanMailboxManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
@ -212,8 +213,8 @@ update flags msg model =
--- View2 --- View2
view2 : Flags -> UiSettings -> Model -> Html Msg view2 : Texts -> Flags -> UiSettings -> Model -> Html Msg
view2 flags settings model = view2 texts flags settings model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
(div (div
[ classList [ classList
@ -228,34 +229,38 @@ view2 flags settings model =
] ]
:: (case model.detailModel of :: (case model.detailModel of
Just msett -> Just msett ->
viewForm2 flags settings msett viewForm2 texts flags settings msett
Nothing -> Nothing ->
viewList2 model viewList2 texts model
) )
) )
viewForm2 : Flags -> UiSettings -> Comp.ScanMailboxForm.Model -> List (Html Msg) viewForm2 : Texts -> Flags -> UiSettings -> Comp.ScanMailboxForm.Model -> List (Html Msg)
viewForm2 flags settings model = viewForm2 texts flags settings model =
[ Html.map DetailMsg [ Html.map DetailMsg
(Comp.ScanMailboxForm.view2 flags "" settings model) (Comp.ScanMailboxForm.view2 texts.form flags "" settings model)
] ]
viewList2 : Model -> List (Html Msg) viewList2 : Texts -> Model -> List (Html Msg)
viewList2 model = viewList2 texts model =
[ MB.view [ MB.view
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = NewTask { tagger = NewTask
, label = "New Task" , label = texts.newTask
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, title = "Create a new scan mailbox task" , title = texts.createNewTask
} }
] ]
, end = [] , end = []
, rootClasses = "mb-4" , 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) (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 : UiSettings -> Model -> Comp.Tabs.Tab Msg -> ( Comp.Tabs.State, Msg )
searchTabState settings model tab = searchTabState settings model tab =
let let
@ -943,52 +1034,55 @@ searchTabState settings model tab =
Data.UiSettings.fieldHidden settings f Data.UiSettings.fieldHidden settings f
hidden = hidden =
case tab.title of case findTab tab of
"Tags" -> Just TabTags ->
isHidden Data.Fields.Tag isHidden Data.Fields.Tag
"Tag Categories" -> Just TabTagCategories ->
isHidden Data.Fields.Tag isHidden Data.Fields.Tag
"Folder" -> Just TabFolder ->
isHidden Data.Fields.Folder isHidden Data.Fields.Folder
"Correspondent" -> Just TabCorrespondent ->
isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson isHidden Data.Fields.CorrOrg && isHidden Data.Fields.CorrPerson
"Concerning" -> Just TabConcerning ->
isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson isHidden Data.Fields.ConcEquip && isHidden Data.Fields.ConcPerson
"Custom Fields" -> Just TabCustomFields ->
isHidden Data.Fields.CustomFields isHidden Data.Fields.CustomFields
|| Comp.CustomFieldMultiInput.isEmpty model.customFieldModel || Comp.CustomFieldMultiInput.isEmpty model.customFieldModel
"Date" -> Just TabDate ->
isHidden Data.Fields.Date isHidden Data.Fields.Date
"Due Date" -> Just TabDueDate ->
isHidden Data.Fields.DueDate isHidden Data.Fields.DueDate
"Source" -> Just TabSource ->
isHidden Data.Fields.SourceName isHidden Data.Fields.SourceName
"Direction" -> Just TabDirection ->
isHidden Data.Fields.Direction isHidden Data.Fields.Direction
_ -> Just TabInbox ->
False
Nothing ->
False False
state = state =
if hidden then if hidden then
Comp.Tabs.Hidden Comp.Tabs.Hidden
else if Set.member tab.title model.openTabs then else if Set.member tab.name model.openTabs then
Comp.Tabs.Open Comp.Tabs.Open
else else
Comp.Tabs.Closed Comp.Tabs.Closed
in in
( state, ToggleAkkordionTab tab.title ) ( state, ToggleAkkordionTab tab.name )
searchTabs : DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg) searchTabs : DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
@ -1032,7 +1126,8 @@ searchTabs ddd flags settings model =
, style = DS.sidebarStyle , style = DS.sidebarStyle
} }
in in
[ { title = "Inbox" [ { name = tabName TabInbox
, title = "Inbox"
, info = Nothing , info = Nothing
, titleRight = [] , titleRight = []
, body = , body =
@ -1091,7 +1186,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Tags" , { name = tabName TabTags
, title = "Tags"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1103,7 +1199,8 @@ searchTabs ddd flags settings model =
model.tagSelectModel model.tagSelectModel
) )
} }
, { title = "Tag Categories" , { name = tabName TabTagCategories
, title = "Tag Categories"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1115,7 +1212,8 @@ searchTabs ddd flags settings model =
) )
] ]
} }
, { title = "Folder" , { name = tabName TabFolder
, title = "Folder"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1126,7 +1224,8 @@ searchTabs ddd flags settings model =
) )
] ]
} }
, { title = "Correspondent" , { name = tabName TabCorrespondent
, title = "Correspondent"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1157,7 +1256,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Concerning" , { name = tabName TabConcerning
, title = "Concerning"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1187,7 +1287,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Custom Fields" , { name = tabName TabCustomFields
, title = "Custom Fields"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1199,7 +1300,8 @@ searchTabs ddd flags settings model =
) )
] ]
} }
, { title = "Date" , { name = tabName TabDate
, title = "Date"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1238,7 +1340,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Due Date" , { name = tabName TabDueDate
, title = "Due Date"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1281,7 +1384,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Source" , { name = tabName TabSource
, title = "Source"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1298,7 +1402,8 @@ searchTabs ddd flags settings model =
] ]
] ]
} }
, { title = "Direction" , { name = tabName TabDirection
, title = "Direction"
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =

View File

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

View File

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

View File

@ -2,7 +2,6 @@ module Data.SSLType exposing
( SSLType(..) ( SSLType(..)
, all , all
, fromString , fromString
, label
, toString , toString
) )
@ -45,16 +44,3 @@ fromString str =
_ -> _ ->
Nothing 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 (..) module Messages.UserSettingsPage exposing (..)
import Messages.ChangePasswordFormComp import Messages.ChangePasswordFormComp
import Messages.EmailSettingsManageComp
import Messages.ImapSettingsManageComp
import Messages.NotificationManageComp
import Messages.ScanMailboxManageComp
import Messages.UiSettingsManageComp import Messages.UiSettingsManageComp
type alias Texts = type alias Texts =
{ changePasswordForm : Messages.ChangePasswordFormComp.Texts { changePasswordForm : Messages.ChangePasswordFormComp.Texts
, uiSettingsManage : Messages.UiSettingsManageComp.Texts , uiSettingsManage : Messages.UiSettingsManageComp.Texts
, emailSettingsManage : Messages.EmailSettingsManageComp.Texts
, imapSettingsManage : Messages.ImapSettingsManageComp.Texts
, notificationManage : Messages.NotificationManageComp.Texts
, scanMailboxManage : Messages.ScanMailboxManageComp.Texts
, userSettings : String , userSettings : String
, uiSettings : String , uiSettings : String
, notifications : String , notifications : String
@ -15,6 +23,10 @@ type alias Texts =
, emailSettingImap : String , emailSettingImap : String
, changePassword : String , changePassword : String
, uiSettingsInfo : String , uiSettingsInfo : String
, notificationInfoText : String
, notificationRemindDaysInfo : String
, scanMailboxInfo1 : String
, scanMailboxInfo2 : String
} }
@ -22,6 +34,10 @@ gb : Texts
gb = gb =
{ changePasswordForm = Messages.ChangePasswordFormComp.gb { changePasswordForm = Messages.ChangePasswordFormComp.gb
, uiSettingsManage = Messages.UiSettingsManageComp.gb , uiSettingsManage = Messages.UiSettingsManageComp.gb
, emailSettingsManage = Messages.EmailSettingsManageComp.gb
, imapSettingsManage = Messages.ImapSettingsManageComp.gb
, notificationManage = Messages.NotificationManageComp.gb
, scanMailboxManage = Messages.ScanMailboxManageComp.gb
, userSettings = "User Settings" , userSettings = "User Settings"
, uiSettings = "UI Settings" , uiSettings = "UI Settings"
, notifications = "Notifications" , notifications = "Notifications"
@ -32,6 +48,27 @@ gb =
, uiSettingsInfo = , uiSettingsInfo =
"These settings only affect the web ui. They are stored in the browser, " "These settings only affect the web ui. They are stored in the browser, "
++ "so they are separated between browsers and devices." ++ "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 exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Markdown
import Messages.UserSettingsPage exposing (Texts) import Messages.UserSettingsPage exposing (Texts)
import Page.UserSettings.Data exposing (..) import Page.UserSettings.Data exposing (..)
import Styles as S import Styles as S
@ -111,16 +112,16 @@ viewContent texts flags settings model =
viewChangePassword texts model viewChangePassword texts model
Just EmailSettingsTab -> Just EmailSettingsTab ->
viewEmailSettings settings model viewEmailSettings texts settings model
Just NotificationTab -> Just NotificationTab ->
viewNotificationManage settings model viewNotificationManage texts settings model
Just ImapSettingsTab -> Just ImapSettingsTab ->
viewImapSettings settings model viewImapSettings texts settings model
Just ScanMailboxTab -> Just ScanMailboxTab ->
viewScanMailboxManage flags settings model viewScanMailboxManage texts flags settings model
Just UiSettingsTab -> Just UiSettingsTab ->
viewUiSettings texts flags settings model viewUiSettings texts flags settings model
@ -186,100 +187,91 @@ viewUiSettings texts flags settings model =
] ]
viewEmailSettings : UiSettings -> Model -> List (Html Msg) viewEmailSettings : Texts -> UiSettings -> Model -> List (Html Msg)
viewEmailSettings settings model = viewEmailSettings texts settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ i [ class "fa fa-envelope" ] [] [ i [ class "fa fa-envelope" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text "E-Mail Settings (Smtp)" [ text texts.emailSettingSmtp
] ]
] ]
, Html.map EmailSettingsMsg , Html.map EmailSettingsMsg
(Comp.EmailSettingsManage.view2 (Comp.EmailSettingsManage.view2
texts.emailSettingsManage
settings settings
model.emailSettingsModel model.emailSettingsModel
) )
] ]
viewImapSettings : UiSettings -> Model -> List (Html Msg) viewImapSettings : Texts -> UiSettings -> Model -> List (Html Msg)
viewImapSettings settings model = viewImapSettings texts settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ i [ class "fa fa-envelope" ] [] [ i [ class "fa fa-envelope" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text "E-Mail Settings (Imap)" [ text texts.emailSettingImap
] ]
] ]
, Html.map ImapSettingsMsg , Html.map ImapSettingsMsg
(Comp.ImapSettingsManage.view2 (Comp.ImapSettingsManage.view2
texts.imapSettingsManage
settings settings
model.imapSettingsModel model.imapSettingsModel
) )
] ]
viewNotificationManage : UiSettings -> Model -> List (Html Msg) viewNotificationManage : Texts -> UiSettings -> Model -> List (Html Msg)
viewNotificationManage settings model = viewNotificationManage texts settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ i [ class "fa fa-bullhorn" ] [] [ i [ class "fa fa-bullhorn" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text "Notification" [ text texts.notifications
] ]
] ]
, p [ class "opacity-80 text-lg mb-3" ] , p [ class "opacity-80 text-lg mb-3" ]
[ text """ [ text texts.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."""
] ]
, p [ class "opacity-80 text-lg mb-3" ] , p [ class "opacity-80 text-lg mb-3" ]
[ text "Docspell finds all items that are due in " [ Markdown.toHtml [] texts.notificationRemindDaysInfo
, em [ class "font-italic" ] [ text "Remind Days" ]
, text " days and sends this list via e-mail."
] ]
, Html.map NotificationMsg , 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 : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewScanMailboxManage flags settings model = viewScanMailboxManage texts flags settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ i [ class "fa fa-envelope-open font-thin" ] [] [ i [ class "fa fa-envelope-open font-thin" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text "Scan Mailbox" [ text texts.scanMailbox
] ]
] ]
, p [ class "opacity-80 text-lg mb-3" ] , p [ class "opacity-80 text-lg mb-3" ]
[ text "Docspell can scan folders of your mailbox to import your mails. " [ text texts.scanMailboxInfo1
, text "You need to provide a connection in "
, text "your e-mail (imap) settings."
] ]
, p [ class "opacity-80 text-lg mb-3 hidden" ] , p [ class "opacity-80 text-lg mb-3 hidden" ]
[ text """ [ text texts.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."""
] ]
, Html.map ScanMailboxMsg , Html.map ScanMailboxMsg
(Comp.ScanMailboxManage.view2 (Comp.ScanMailboxManage.view2
texts.scanMailboxManage
flags flags
settings settings
model.scanMailboxModel model.scanMailboxModel