Dropdown cc and bcc recipients in mail form

This commit is contained in:
eikek
2021-10-24 00:53:56 +02:00
parent f5bb85c61e
commit 28993e27e5
2 changed files with 33 additions and 2 deletions

View File

@ -49,6 +49,7 @@ type alias Model =
, body : String , body : String
, attachAll : Bool , attachAll : Bool
, formError : FormError , formError : FormError
, showCC : Bool
} }
@ -65,6 +66,7 @@ type Msg
| BCCRecipientMsg Comp.EmailInput.Msg | BCCRecipientMsg Comp.EmailInput.Msg
| SetBody String | SetBody String
| SetSubjectBody String String | SetSubjectBody String String
| ToggleShowCC
| ConnMsg (Comp.Dropdown.Msg String) | ConnMsg (Comp.Dropdown.Msg String)
| ConnResp (Result Http.Error EmailSettingsList) | ConnResp (Result Http.Error EmailSettingsList)
| ToggleAttachAll | ToggleAttachAll
@ -97,6 +99,7 @@ emptyModel =
, body = "" , body = ""
, attachAll = True , attachAll = True
, formError = FormErrorNone , formError = FormErrorNone
, showCC = False
} }
@ -189,6 +192,9 @@ update flags msg model =
ToggleAttachAll -> ToggleAttachAll ->
( { model | attachAll = not model.attachAll }, Cmd.none, FormNone ) ( { model | attachAll = not model.attachAll }, Cmd.none, FormNone )
ToggleShowCC ->
( { model | showCC = not model.showCC }, Cmd.none, FormNone )
ConnResp (Ok list) -> ConnResp (Ok list) ->
let let
names = names =
@ -324,9 +330,22 @@ view texts settings cfg model =
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ label
[ class S.inputLabel [ class S.inputLabel
, class "flex flex-row"
] ]
[ text texts.recipients [ text texts.recipients
, B.inputRequired , B.inputRequired
, a
[ class S.link
, class "justify-end flex flex-grow"
, onClick ToggleShowCC
, href "#"
]
[ if model.showCC then
text texts.lessRecipients
else
text texts.moreRecipients
]
] ]
, Html.map RecipientMsg , Html.map RecipientMsg
(Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.recipients } (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.recipients }
@ -334,7 +353,10 @@ view texts settings cfg model =
model.recipientsModel model.recipientsModel
) )
] ]
, div [ class "mb-4" ] , div
[ class "mb-4"
, classList [ ( "hidden", not model.showCC ) ]
]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text texts.ccRecipients [ text texts.ccRecipients
] ]
@ -344,7 +366,10 @@ view texts settings cfg model =
model.ccRecipientsModel model.ccRecipientsModel
) )
] ]
, div [ class "mb-4" ] , div
[ class "mb-4"
, classList [ ( "hidden", not model.showCC ) ]
]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text texts.bccRecipients [ text texts.bccRecipients
] ]

View File

@ -29,6 +29,8 @@ type alias Texts =
, includeAllAttachments : String , includeAllAttachments : String
, connectionMissing : String , connectionMissing : String
, sendLabel : String , sendLabel : String
, moreRecipients : String
, lessRecipients : String
} }
@ -46,6 +48,8 @@ gb =
, includeAllAttachments = "Include all item attachments" , includeAllAttachments = "Include all item attachments"
, connectionMissing = "No E-Mail connections configured. Goto user settings to add one." , connectionMissing = "No E-Mail connections configured. Goto user settings to add one."
, sendLabel = "Send" , sendLabel = "Send"
, moreRecipients = "More"
, lessRecipients = "Less"
} }
@ -63,4 +67,6 @@ de =
, includeAllAttachments = "Alle Anhänge mit einfügen" , includeAllAttachments = "Alle Anhänge mit einfügen"
, connectionMissing = "Keine E-Mail-Verbindung definiert. Gehe zu den Benutzereinstellungen und füge eine hinzu." , connectionMissing = "Keine E-Mail-Verbindung definiert. Gehe zu den Benutzereinstellungen und füge eine hinzu."
, sendLabel = "Senden" , sendLabel = "Senden"
, moreRecipients = "Weitere"
, lessRecipients = "Weniger"
} }