Module: EmailHelper

Included in:
UserNotificationRenderer
Defined in:
app/helpers/email_helper.rb

Instance Method Summary collapse

Instance Method Details

#email_html_templateObject



30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/email_helper.rb', line 30

def email_html_template
  EmailStyle
    .new
    .html
    .sub("%{email_content}") { capture { yield } }
    .gsub("%{html_lang}", html_lang)
    .gsub("%{dark_mode_meta_tags}", dark_mode_meta_tags)
    .gsub("%{dark_mode_styles}", dark_mode_styles)
    .html_safe
end


25
26
27
28
# File 'app/helpers/email_helper.rb', line 25

def email_topic_link(topic)
  url, title = extract_details(topic)
  raw "<a href='#{Discourse.base_url}#{url}' style='color: ##{@anchor_color}'>#{title}</a>"
end

#mailing_list_topic(topic, post_count) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/helpers/email_helper.rb', line 6

def mailing_list_topic(topic, post_count)
  render(
    partial: partial_for("mailing_list_post"),
    locals: {
      topic: topic,
      post_count: post_count,
    },
  )
end

#mailing_list_topic_text(topic) ⇒ Object



16
17
18
19
# File 'app/helpers/email_helper.rb', line 16

def mailing_list_topic_text(topic)
  url, title = extract_details(topic)
  raw(@markdown_linker.create(title, url))
end

#private_topic_title(topic) ⇒ Object



21
22
23
# File 'app/helpers/email_helper.rb', line 21

def private_topic_title(topic)
  I18n.t("system_messages.private_topic_title", id: topic.id)
end