From 3322164af50ecf7befbcf3a420723c68da6ee48f Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Fri, 5 Aug 2016 12:38:00 +0200 Subject: [PATCH 1/4] Add missing email html template for shipped_email Move the html template from ShippedMailer to CartonMailer (ref https://github.com/solidusio/solidus/commit/9ff3f310e0b3f274fce6f5a2b25fe7dd6859bab7) --- .../shipped_email.html.erb | 6 +++--- core/spec/mailers/carton_mailer_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename core/app/views/spree/{shipment_mailer => carton_mailer}/shipped_email.html.erb (82%) diff --git a/core/app/views/spree/shipment_mailer/shipped_email.html.erb b/core/app/views/spree/carton_mailer/shipped_email.html.erb similarity index 82% rename from core/app/views/spree/shipment_mailer/shipped_email.html.erb rename to core/app/views/spree/carton_mailer/shipped_email.html.erb index 24c0c6c1b34..b4a1892c8f1 100644 --- a/core/app/views/spree/shipment_mailer/shipped_email.html.erb +++ b/core/app/views/spree/carton_mailer/shipped_email.html.erb @@ -11,7 +11,7 @@ <%= Spree.t('shipment_mailer.shipped_email.shipment_summary') %>

- <% @shipment.manifest.each do |item| %> + <% @manifest.each do |item| %> @@ -20,10 +20,10 @@ <% end %>
<%= item.variant.sku %> <%= item.variant.product.name %>

- <%= Spree.t('shipment_mailer.shipped_email.track_information', tracking: @shipment.tracking) if @shipment.tracking %> + <%= Spree.t('shipment_mailer.shipped_email.track_information', tracking: @carton.tracking) if @carton.tracking %>

- <%= Spree.t('shipment_mailer.shipped_email.track_link', :url => @shipment.tracking_url) if @shipment.tracking_url %> + <%= Spree.t('shipment_mailer.shipped_email.track_link', :url => @carton.tracking_url) if @carton.tracking_url %>

<%= Spree.t('shipment_mailer.shipped_email.thanks') %> diff --git a/core/spec/mailers/carton_mailer_spec.rb b/core/spec/mailers/carton_mailer_spec.rb index 7f85244a68c..1ca9ea5e603 100644 --- a/core/spec/mailers/carton_mailer_spec.rb +++ b/core/spec/mailers/carton_mailer_spec.rb @@ -11,8 +11,8 @@ # Regression test for https://github.com/spree/spree/issues/2196 it "doesn't include out of stock in the email body" do shipment_email = Spree::CartonMailer.shipped_email(order: order, carton: carton) - expect(shipment_email.body).not_to include(%{Out of Stock}) - expect(shipment_email.body).to include(%{Your order has been shipped}) + expect(shipment_email).not_to have_body_text(%{Out of Stock}) + expect(shipment_email).to have_body_text(%{Your order has been shipped}) expect(shipment_email.subject).to eq "#{order.store.name} Shipment Notification ##{order.number}" end @@ -38,7 +38,7 @@ specify do shipped_email = Spree::CartonMailer.shipped_email(order: order, carton: carton) - expect(shipped_email.body).to include("Caro Cliente,") + expect(shipped_email).to have_body_text("Caro Cliente,") end end end From 67914228162aaf3cedb4bec2aeaf00fe608a2957 Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Fri, 5 Aug 2016 15:02:01 +0200 Subject: [PATCH 2/4] Add email html for inventory_cancellation --- .../inventory_cancellation_email.html.erb | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb diff --git a/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb b/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb new file mode 100644 index 00000000000..a9f3b7004c0 --- /dev/null +++ b/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb @@ -0,0 +1,26 @@ + + + + + +
+

+ <%= Spree.t('order_mailer.inventory_cancellation.dear_customer') %> +

+

+ <%= Spree.t('order_mailer.inventory_cancellation.instructions') %> +

+

+ <%= Spree.t('order_mailer.inventory_cancellation.order_summary_canceled') %> +

+ + <% @inventory_units.each do |item| %> + + + + + + <% end %> +
<%= item.variant.sku %><%= raw(item.variant.product.name) %><%= raw(item.variant.options_text) -%>
+

+

From 44644027b14b137615b40cef138d38c6f8fc12b6 Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Thu, 11 Aug 2016 16:31:11 +0200 Subject: [PATCH 3/4] Remove raw from email template The product informations in email templates was not escaped because was used `raw` method. --- core/app/views/spree/order_mailer/cancel_email.html.erb | 6 +++--- core/app/views/spree/order_mailer/confirm_email.html.erb | 4 ++-- .../order_mailer/inventory_cancellation_email.html.erb | 4 ++-- .../spree/reimbursement_mailer/reimbursement_email.html.erb | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/app/views/spree/order_mailer/cancel_email.html.erb b/core/app/views/spree/order_mailer/cancel_email.html.erb index 5fc4f6700a9..90358e7bedd 100644 --- a/core/app/views/spree/order_mailer/cancel_email.html.erb +++ b/core/app/views/spree/order_mailer/cancel_email.html.erb @@ -15,8 +15,8 @@ <%= item.variant.sku %> - <%= raw(item.variant.product.name) %> - <%= raw(item.variant.options_text) -%> + <%= item.variant.product.name %> + <%= item.variant.options_text -%> (<%=item.quantity%>) @ <%= item.single_money %> = <%= item.display_amount %> @@ -29,7 +29,7 @@ <% @order.adjustments.eligible.each do |adjustment| %> - <%= raw(adjustment.label) %> + <%= sanitize(adjustment.label) %> <%= adjustment.display_amount %> <% end %> diff --git a/core/app/views/spree/order_mailer/confirm_email.html.erb b/core/app/views/spree/order_mailer/confirm_email.html.erb index f5498dcf5ac..1b3e9a4ac75 100644 --- a/core/app/views/spree/order_mailer/confirm_email.html.erb +++ b/core/app/views/spree/order_mailer/confirm_email.html.erb @@ -15,8 +15,8 @@ <%= item.variant.sku %> - <%= raw(item.variant.product.name) %> - <%= raw(item.variant.options_text) -%> + <%= item.variant.product.name %> + <%= item.variant.options_text -%> (<%=item.quantity%>) @ <%= item.single_money %> = <%= item.display_amount %> diff --git a/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb b/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb index a9f3b7004c0..b4a36db1225 100644 --- a/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb +++ b/core/app/views/spree/order_mailer/inventory_cancellation_email.html.erb @@ -14,8 +14,8 @@ <% @inventory_units.each do |item| %> <%= item.variant.sku %> - <%= raw(item.variant.product.name) %> - <%= raw(item.variant.options_text) -%> + <%= item.variant.product.name %> + <%= item.variant.options_text -%> <% end %> diff --git a/core/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb b/core/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb index baceffa5f2d..aaf518980c0 100644 --- a/core/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb +++ b/core/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb @@ -21,13 +21,13 @@ <% @reimbursement.return_items.exchange_requested.each do |return_item| %> - <%= return_item.variant.sku %> <%= raw(return_item.variant.name) %> <%= "(#{raw(return_item.variant.options_text)})" if return_item.variant.options_text.present? %> + <%= return_item.variant.sku %> <%= return_item.variant.name %> <%= "(#{return_item.variant.options_text})" if return_item.variant.options_text.present? %> -> - <%= return_item.exchange_variant.sku %> <%= raw(return_item.exchange_variant.name) %> <%= "(#{raw(return_item.exchange_variant.options_text)})" if return_item.exchange_variant.options_text.present? %> + <%= return_item.exchange_variant.sku %> <%= return_item.exchange_variant.name %> <%= "(#{return_item.exchange_variant.options_text})" if return_item.exchange_variant.options_text.present? %> <% end %> From 682f6ae89809b1f1bd5e99faa446d7eac9621651 Mon Sep 17 00:00:00 2001 From: Daniele Palombo Date: Tue, 13 Jun 2017 10:26:44 +0200 Subject: [PATCH 4/4] Add a CHANGELOG line for add html templates --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e131df3475..66b558b5ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Solidus 2.3.0 (master, unreleased) +- Add missing email html template for shipped_email and inventory_cancellation - Deprecate `Spree::Core::CurrentStore` in favor of `Spree::CurrentStoreSelector`. [\#1993](https://github.com/solidusio/solidus/pull/1993) - Deprecate `Spree::Order#assign_default_addresses!` in favor of `Order.new.assign_default_user_addresses`. [\#1954](https://github.com/solidusio/solidus/pull/1954) ([kennyadsl](https://github.com/kennyadsl)) - Change how line item options are allowed in line items controller. [\#1943](https://github.com/solidusio/solidus/pull/1943)