From cde3206478341d0723ff13d8600f1754fd61f650 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 3 Apr 2024 16:10:59 -0400 Subject: [PATCH] Simplify feature loop in welcome mailer (#29760) --- app/views/application/mailer/_feature.html.haml | 10 ++++------ app/views/user_mailer/welcome.html.haml | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/views/application/mailer/_feature.html.haml b/app/views/application/mailer/_feature.html.haml index d051338a9c..5facdd0866 100644 --- a/app/views/application/mailer/_feature.html.haml +++ b/app/views/application/mailer/_feature.html.haml @@ -11,10 +11,8 @@ %table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-column-td - - if defined?(feature_title) - %h2.email-h2= feature_title - - if defined?(feature_text) - %p.email-p= feature_text + %h2.email-h2= t("user_mailer.welcome.feature_#{feature}_title") + %p.email-p= t("user_mailer.welcome.feature_#{feature}") - if defined?(feature_btn_url) = link_to '', href: feature_btn_url, class: 'email-link-with-arrow' do #{t('user_mailer.welcome.feature_action')}  @@ -25,8 +23,8 @@ %table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-column-td - - if defined?(key) + - if defined?(feature) %p{ class: ('email-desktop-text-right' if defined?(text_first_on_desktop) && text_first_on_desktop) } - = image_tag frontend_asset_url("images/mailer-new/welcome/#{key}.png"), alt: '', width: 240, height: 230 + = image_tag frontend_asset_url("images/mailer-new/welcome/feature_#{feature}.png"), alt: '', width: 240, height: 230 /[if mso] diff --git a/app/views/user_mailer/welcome.html.haml b/app/views/user_mailer/welcome.html.haml index 0e55707d36..97fb0a2c97 100644 --- a/app/views/user_mailer/welcome.html.haml +++ b/app/views/user_mailer/welcome.html.haml @@ -68,7 +68,7 @@ %table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' } %tr %td.email-extra-td - = render 'application/mailer/feature', key: 'feature_control', feature_title: t('user_mailer.welcome.feature_control_title'), feature_text: t('user_mailer.welcome.feature_control'), text_first_on_desktop: true - = render 'application/mailer/feature', key: 'feature_audience', feature_title: t('user_mailer.welcome.feature_audience_title'), feature_text: t('user_mailer.welcome.feature_audience'), text_first_on_desktop: false - = render 'application/mailer/feature', key: 'feature_moderation', feature_title: t('user_mailer.welcome.feature_moderation_title'), feature_text: t('user_mailer.welcome.feature_moderation'), text_first_on_desktop: true - = render 'application/mailer/feature', key: 'feature_creativity', feature_title: t('user_mailer.welcome.feature_creativity_title'), feature_text: t('user_mailer.welcome.feature_creativity'), text_first_on_desktop: false + = render 'application/mailer/feature', feature: 'control', text_first_on_desktop: true + = render 'application/mailer/feature', feature: 'audience', text_first_on_desktop: false + = render 'application/mailer/feature', feature: 'moderation', text_first_on_desktop: true + = render 'application/mailer/feature', feature: 'creativity', text_first_on_desktop: false