Module: Decidim::NewslettersHelper
- Defined in:
- app/helpers/decidim/newsletters_helper.rb
Overview
Helper that provides methods to render links with utm codes, and replaced name
Instance Method Summary collapse
-
#custom_url_for_mail_root(organization, newsletter_id = nil) ⇒ String
this method is used to generate the root link on mail with the utm_codes If the newsletter_id is nil, it returns the root_url.
-
#parse_interpolations(content, user = nil, id = nil) ⇒ String
If the newsletter body there are some links and the Decidim.track_newsletter_links = true it will be replaced with the utm_codes method described below.
Instance Method Details
#custom_url_for_mail_root(organization, newsletter_id = nil) ⇒ String
this method is used to generate the root link on mail with the utm_codes If the newsletter_id is nil, it returns the root_url
33 34 35 36 37 38 39 40 |
# File 'app/helpers/decidim/newsletters_helper.rb', line 33 def custom_url_for_mail_root(organization, = nil) decidim = EngineRouter.new("decidim", {}) if .present? decidim.root_url(host: organization.host) + utm_codes(organization.host, .to_s) else decidim.root_url(host: organization.host) end end |
#parse_interpolations(content, user = nil, id = nil) ⇒ String
If the newsletter body there are some links and the Decidim.track_newsletter_links = true it will be replaced with the utm_codes method described below. for example transform “es.lipsum.com/” to “es.lipsum.com/?utm_source=localhost&utm_campaign=newsletter_11” And replace “%name” on the subject or content of newsletter to the user Name for example transform “%name” to “User Name”
17 18 19 20 21 22 23 |
# File 'app/helpers/decidim/newsletters_helper.rb', line 17 def parse_interpolations(content, user = nil, id = nil) host = user&.organization&.host&.to_s content = interpret_name(content, user) content = (content, id, host) transform_image_urls(content, host) end |