mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Merge pull request #1274 from eikek/feature/email-content
Feature/email content
This commit is contained in:
@ -46,6 +46,7 @@ type alias Model =
|
||||
, queryModel : Comp.PowerSearchInput.Model
|
||||
, channelModel : Comp.ChannelForm.Model
|
||||
, bookmarkDropdown : Comp.BookmarkDropdown.Model
|
||||
, contentStart : Maybe String
|
||||
, formState : FormState
|
||||
, loading : Int
|
||||
, deleteRequested : Bool
|
||||
@ -79,6 +80,7 @@ type Msg
|
||||
| QueryMsg Comp.PowerSearchInput.Msg
|
||||
| ChannelMsg Comp.ChannelForm.Msg
|
||||
| BookmarkMsg Comp.BookmarkDropdown.Msg
|
||||
| SetContentStart String
|
||||
| StartOnce
|
||||
| Cancel
|
||||
| RequestDelete
|
||||
@ -115,6 +117,7 @@ initWith flags s =
|
||||
, queryModel = res.model
|
||||
, channelModel = cfm
|
||||
, bookmarkDropdown = bm
|
||||
, contentStart = Nothing
|
||||
, formState = FormStateInitial
|
||||
, loading = 0
|
||||
, summary = s.summary
|
||||
@ -151,6 +154,7 @@ init flags ct =
|
||||
, queryModel = Comp.PowerSearchInput.init
|
||||
, channelModel = cfm
|
||||
, bookmarkDropdown = bm
|
||||
, contentStart = Nothing
|
||||
, formState = FormStateInitial
|
||||
, loading = 0
|
||||
, summary = Nothing
|
||||
@ -218,6 +222,7 @@ makeSettings model =
|
||||
, channel = channel
|
||||
, query = Tuple.first q
|
||||
, bookmark = Tuple.second q
|
||||
, contentStart = model.contentStart
|
||||
}
|
||||
in
|
||||
Result.map3 make
|
||||
@ -299,6 +304,13 @@ update flags msg model =
|
||||
, sub = Sub.none
|
||||
}
|
||||
|
||||
SetContentStart str ->
|
||||
{ model = { model | contentStart = Util.Maybe.fromString str }
|
||||
, action = NoAction
|
||||
, cmd = Cmd.none
|
||||
, sub = Sub.none
|
||||
}
|
||||
|
||||
ToggleEnabled ->
|
||||
{ model =
|
||||
{ model
|
||||
@ -545,6 +557,22 @@ view texts extraClasses settings model =
|
||||
, queryInput
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ formHeader texts.messageContentTitle False
|
||||
, label [ class S.inputLabel ]
|
||||
[ text texts.messageContentLabel
|
||||
]
|
||||
, textarea
|
||||
[ onInput SetContentStart
|
||||
, Maybe.withDefault "" model.contentStart |> value
|
||||
, placeholder texts.messageContentPlaceholder
|
||||
, class S.textAreaInput
|
||||
]
|
||||
[]
|
||||
, span [ class "text-sm opacity-75" ]
|
||||
[ text texts.messageContentInfo
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ formHeader texts.schedule False
|
||||
, label [ class S.inputLabel ]
|
||||
|
@ -20,6 +20,7 @@ type alias PeriodicQuerySettings =
|
||||
, channel : NotificationChannel
|
||||
, query : Maybe String
|
||||
, bookmark : Maybe String
|
||||
, contentStart : Maybe String
|
||||
, schedule : String
|
||||
}
|
||||
|
||||
@ -32,19 +33,21 @@ empty ct =
|
||||
, channel = Data.NotificationChannel.empty ct
|
||||
, query = Nothing
|
||||
, bookmark = Nothing
|
||||
, contentStart = Nothing
|
||||
, schedule = ""
|
||||
}
|
||||
|
||||
|
||||
decoder : D.Decoder PeriodicQuerySettings
|
||||
decoder =
|
||||
D.map7 PeriodicQuerySettings
|
||||
D.map8 PeriodicQuerySettings
|
||||
(D.field "id" D.string)
|
||||
(D.field "enabled" D.bool)
|
||||
(D.maybe (D.field "summary" D.string))
|
||||
(D.field "channel" Data.NotificationChannel.decoder)
|
||||
(D.maybe (D.field "query" D.string))
|
||||
(D.maybe (D.field "bookmark" D.string))
|
||||
(D.maybe (D.field "contentStart" D.string))
|
||||
(D.field "schedule" D.string)
|
||||
|
||||
|
||||
@ -57,5 +60,6 @@ encode s =
|
||||
, ( "channel", Data.NotificationChannel.encode s.channel )
|
||||
, ( "query", Maybe.map E.string s.query |> Maybe.withDefault E.null )
|
||||
, ( "bookmark", Maybe.map E.string s.bookmark |> Maybe.withDefault E.null )
|
||||
, ( "contentStart", Maybe.map E.string s.contentStart |> Maybe.withDefault E.null )
|
||||
, ( "schedule", E.string s.schedule )
|
||||
]
|
||||
|
@ -42,6 +42,10 @@ type alias Texts =
|
||||
, channelRequired : String
|
||||
, queryStringRequired : String
|
||||
, channelHeader : ChannelType -> String
|
||||
, messageContentTitle : String
|
||||
, messageContentLabel : String
|
||||
, messageContentInfo : String
|
||||
, messageContentPlaceholder : String
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +75,10 @@ gb =
|
||||
, channelRequired = "A valid channel must be given."
|
||||
, queryStringRequired = "A query string and/or bookmark must be supplied"
|
||||
, channelHeader = \ct -> "Connection details for " ++ Messages.Data.ChannelType.gb ct
|
||||
, messageContentTitle = "Customize message"
|
||||
, messageContentLabel = "Beginning of message"
|
||||
, messageContentInfo = "Insert text that is prependend to the generated message."
|
||||
, messageContentPlaceholder = "Hello, this is Docspell informing you about new items …"
|
||||
}
|
||||
|
||||
|
||||
@ -100,4 +108,8 @@ de =
|
||||
, channelRequired = "Ein Versandkanal muss angegeben werden."
|
||||
, queryStringRequired = "Eine Suchabfrage und/oder ein Bookmark muss angegeben werden."
|
||||
, channelHeader = \ct -> "Details für " ++ Messages.Data.ChannelType.de ct
|
||||
, messageContentTitle = "Nachricht anpassen"
|
||||
, messageContentLabel = "Anfang der Nachricht"
|
||||
, messageContentInfo = "Dieser Text wird an den Anfang der generierten Nachricht angefügt."
|
||||
, messageContentPlaceholder = "Hallo, hier ist Docspell mit den nächsten Themen …"
|
||||
}
|
||||
|
Reference in New Issue
Block a user