]> git.openstreetmap.org Git - rails.git/blob - app/helpers/notifier_helper.rb
Rubocop fixes for ruby 2.5
[rails.git] / app / helpers / notifier_helper.rb
1 module NotifierHelper
2   def fp(text)
3     format_paragraph(text, 72, 0)
4   end
5
6   def link_to_user(display_name)
7     link_to(
8       content_tag(
9         "strong",
10         display_name,
11         # NB we need "text-decoration: none" twice: GMail only honours it on
12         # the <a> but Outlook only on the <strong>
13         :style => "text-decoration: none"
14       ),
15       user_url(display_name, :host => Settings.server_url),
16       :target => "_blank",
17       :rel => "noopener",
18       :style => "text-decoration: none; color: #222"
19     )
20   end
21
22   def message_body(&block)
23     render(
24       :partial => "message_body",
25       :locals => { :body => capture(&block) }
26     )
27   end
28
29   def style_message(html)
30     # Because we can't use stylesheets in HTML emails, we need to inline the
31     # styles. Rather than copy-paste the same string of CSS into every message,
32     # we apply it once here, after the message has been composed.
33     html.gsub(/<p>/, '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">')
34   end
35 end