Include mailer header logo on custom images list

This commit is contained in:
decabeza
2019-05-21 11:22:04 +02:00
parent 30cd7ec9b2
commit 43dd3d2169
6 changed files with 23 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -1,5 +1,6 @@
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
helper :settings helper :settings
helper :application
default from: "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>" default from: "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>"
layout "mailer" layout "mailer"
end end

View File

@@ -5,7 +5,8 @@ class SiteCustomization::Image < ApplicationRecord
"social_media_icon_twitter" => [246, 246], "social_media_icon_twitter" => [246, 246],
"apple-touch-icon-200" => [200, 200], "apple-touch-icon-200" => [200, 200],
"budget_execution_no_image" => [800, 600], "budget_execution_no_image" => [800, 600],
"map" => [420, 500] "map" => [420, 500],
"logo_email" => [400, 80]
} }
has_attached_file :image has_attached_file :image

View File

@@ -5,7 +5,9 @@
<tr> <tr>
<td style="border-bottom: 1px solid #dadfe1; padding: 20px 0;"> <td style="border-bottom: 1px solid #dadfe1; padding: 20px 0;">
<a href="#" target="_blank"> <a href="#" target="_blank">
<%= 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"]) %>
</a> </a>
</td> </td>
</tr> </tr>

View File

@@ -72,6 +72,23 @@ feature "Admin custom images" do
end end
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 scenario "Upload invalid image" do
visit admin_root_path visit admin_root_path

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB