From a755c72f35d0fa5373337d17cd9769f444659f4b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 1 Aug 2012 13:16:51 +0200 Subject: [PATCH] mail: Include shipment details in the shipping method Allow to explain the shipping method. This is used in the shippment mail. E.g. one can explain the registered mail and the options. --- app/views/admin/dhls/_method_details_form.html.erb | 6 ++++++ .../shipment_mailer/dhls/_tracking_description.text.erb | 1 + db/migrate/20120801104503_dhl_shipping_details.rb | 9 +++++++++ lib/sysmocom_dhl_hooks.rb | 4 ++++ 4 files changed, 20 insertions(+) create mode 100644 app/views/admin/dhls/_method_details_form.html.erb create mode 100644 app/views/shipment_mailer/dhls/_tracking_description.text.erb create mode 100644 db/migrate/20120801104503_dhl_shipping_details.rb diff --git a/app/views/admin/dhls/_method_details_form.html.erb b/app/views/admin/dhls/_method_details_form.html.erb new file mode 100644 index 0000000..3958ce4 --- /dev/null +++ b/app/views/admin/dhls/_method_details_form.html.erb @@ -0,0 +1,6 @@ + <%= f.field_container :details do %> + <%= f.label :details, t("details") %>
+ <%= f.text_area :method_details %> + <%= error_message_on :shipping_method, :method_details %> + <% end %> + diff --git a/app/views/shipment_mailer/dhls/_tracking_description.text.erb b/app/views/shipment_mailer/dhls/_tracking_description.text.erb new file mode 100644 index 0000000..d124ace --- /dev/null +++ b/app/views/shipment_mailer/dhls/_tracking_description.text.erb @@ -0,0 +1 @@ +<%= @shipment.shipping_method.method_details %> diff --git a/db/migrate/20120801104503_dhl_shipping_details.rb b/db/migrate/20120801104503_dhl_shipping_details.rb new file mode 100644 index 0000000..69d9aa0 --- /dev/null +++ b/db/migrate/20120801104503_dhl_shipping_details.rb @@ -0,0 +1,9 @@ +class DhlShippingDetails < ActiveRecord::Migration + def self.up + add_column :shipping_methods, :method_details, :string + end + + def self.down + remove_column :shipping_methods, :method_details + end +end diff --git a/lib/sysmocom_dhl_hooks.rb b/lib/sysmocom_dhl_hooks.rb index 1327fab..cb4429a 100644 --- a/lib/sysmocom_dhl_hooks.rb +++ b/lib/sysmocom_dhl_hooks.rb @@ -6,4 +6,8 @@ class SysmocomDhlHooks < Spree::ThemeSupport::HookListener # Add the DHL label download insert_after :admin_shipment_edit_buttons, 'admin/dhls/address_label' + + # Add shipment identification.. + insert_after :shipment_mailer_shipped_email_tracking, 'shipment_mailer/dhls/tracking_description' + insert_after :admin_shipping_method_form_fields, 'admin/dhls/method_details_form' end