Footer: why the customer got the reminder and how to stop

A new Footer setting, shown under the message (after a rule, small and grey in
the HTML version): "You're getting this email because you have an appointment
with us. Rather not get reminders? Just reply and let us know." Settings saved
before it existed get the default; blank turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-11-01 07:23:33 -05:00
1 parent e363602bea
commit 1c955c7923
6 files changed
+36 -9

No files matched your search

+12 -2
View File
@@ -49,12 +49,22 @@ module RedmineQboReminders
Template.render_line(settings['subject'].presence || Template::DEFAULT_SUBJECT, values)
end
# The message and its footer, as plain text
def text
Template.render(settings['body'].presence || Template::DEFAULT_BODY, values)
[body, footer].compact.join("\n\n--\n")
end
def html
Template.html(text)
Template.html(body, footer)
end
def body
Template.render(settings['body'].presence || Template::DEFAULT_BODY, values)
end
# nil when the footer setting is blank
def footer
Template.render(settings['footer'].to_s, values).presence
end
# The calendar attachment, or nil when it's turned off
+2 -1
View File
@@ -36,7 +36,8 @@ module RedmineQboReminders
'shop_phone' => '',
'shop_address' => '',
'subject' => Template::DEFAULT_SUBJECT,
'body' => Template::DEFAULT_BODY
'body' => Template::DEFAULT_BODY,
'footer' => Template::DEFAULT_FOOTER
}.freeze
def self.current
+13 -4
View File
@@ -33,6 +33,9 @@ module RedmineQboReminders
{{shop_phone}}
TEXT
# Under the message, set apart (smaller and grey in the HTML version): why they got it and how to stop
DEFAULT_FOOTER = "You're getting this email because you have an appointment with us. Rather not get reminders? Just reply and let us know."
module_function
# The text with placeholders filled in (values: { "vehicle" => "2022 Jeep Gladiator", ... })
@@ -52,10 +55,16 @@ module RedmineQboReminders
render(text, values).gsub(/\s+/, ' ').strip
end
# Plain text as simple HTML: paragraphs at blank lines, line breaks kept
def html(text)
paragraphs = text.split(/\n{2,}/).map do |para|
"<p style=\"margin:0 0 1em\">#{para.split("\n").map { |line| CGI.escapeHTML(line) }.join('<br>')}</p>"
# Plain text as simple HTML: paragraphs at blank lines, line breaks kept; the footer after a rule, small
# and grey
def html(text, footer = nil)
para = lambda do |chunk, style|
"<p style=\"#{style}\">#{chunk.split("\n").map { |line| CGI.escapeHTML(line) }.join('<br>')}</p>"
end
paragraphs = text.split(/\n{2,}/).map { |chunk| para.call(chunk, 'margin:0 0 1em') }
if footer.to_s.strip != ''
paragraphs << '<hr style="border:none;border-top:1px solid #ddd;margin:1.5em 0 1em">'
paragraphs += footer.split(/\n{2,}/).map { |chunk| para.call(chunk, 'margin:0 0 0.6em;font-size:12px;color:#777') }
end
<<~HTML
<!DOCTYPE html>