diff --git a/app/assets/images/logo_email.png b/app/assets/images/logo_email.png index 09bc18d63..e8ca37d37 100644 Binary files a/app/assets/images/logo_email.png and b/app/assets/images/logo_email.png differ diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index f7928ff7e..f002cedd6 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,6 @@ class ApplicationMailer < ActionMailer::Base helper :settings + helper :application default from: "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>" layout "mailer" end diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index 12a61dad8..c800e21b1 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -5,7 +5,8 @@ class SiteCustomization::Image < ApplicationRecord "social_media_icon_twitter" => [246, 246], "apple-touch-icon-200" => [200, 200], "budget_execution_no_image" => [800, 600], - "map" => [420, 500] + "map" => [420, 500], + "logo_email" => [400, 80] } has_attached_file :image diff --git a/app/views/layouts/_mailer_header.html.erb b/app/views/layouts/_mailer_header.html.erb index ee37d4be9..894ea9610 100644 --- a/app/views/layouts/_mailer_header.html.erb +++ b/app/views/layouts/_mailer_header.html.erb @@ -5,7 +5,9 @@ - <%= image_tag("logo_email.png", style: "border: 0; display: block; width: 100%;max-width: 370px", alt: setting["org_name"]) %> + <%= image_tag(image_path_for("logo_email.png"), + style: "border: 0;display: block;width: 100%;max-width: 400px", + alt: setting["org_name"]) %> diff --git a/spec/features/admin/site_customization/images_spec.rb b/spec/features/admin/site_customization/images_spec.rb index a8dd454a5..8a5a00c28 100644 --- a/spec/features/admin/site_customization/images_spec.rb +++ b/spec/features/admin/site_customization/images_spec.rb @@ -72,6 +72,23 @@ feature "Admin custom images" do end end + scenario "Image is replaced on admin newsletters" do + newsletter = create(:newsletter, segment_recipient: "all_users") + + visit admin_site_customization_images_path + + within("tr#image_logo_email") do + attach_file "site_customization_image_image", "spec/fixtures/files/logo_email_custom.png" + click_button "Update" + end + + visit admin_newsletter_path(newsletter) + + within(".newsletter-body-content") do + expect(page).to have_css("img[src*='logo_email_custom.png']") + end + end + scenario "Upload invalid image" do visit admin_root_path diff --git a/spec/fixtures/files/logo_email_custom.png b/spec/fixtures/files/logo_email_custom.png new file mode 100644 index 000000000..af31d4d97 Binary files /dev/null and b/spec/fixtures/files/logo_email_custom.png differ