From 061b6e2e4885fb0e3c0ed0ba501f5b826f46f274 Mon Sep 17 00:00:00 2001 From: Michael Bianco Date: Wed, 27 Jun 2012 09:41:22 -0400 Subject: [PATCH] Adding download buttons to invoice (orders#show) --- app/overrides/add_digital_downloads_to_invoice.rb | 14 ++++++++++++++ config/locales/en.yml | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 app/overrides/add_digital_downloads_to_invoice.rb diff --git a/app/overrides/add_digital_downloads_to_invoice.rb b/app/overrides/add_digital_downloads_to_invoice.rb new file mode 100644 index 0000000..4ae7fae --- /dev/null +++ b/app/overrides/add_digital_downloads_to_invoice.rb @@ -0,0 +1,14 @@ +Deface::Override.new(:virtual_path => "spree/shared/_order_details", + :name => "add_digital_downloads_to_invoice", + :insert_bottom => "td[data-hook='order_item_description']", + :text => %q{ +<% if order.state == 'complete' and item.variant.digital? %> + <%= content_tag(:p, :class => 'download_links') do %> + <% item.digital_links.each do |digital_link| %> + <% format = File.extname(digital_link.digital.attachment.path).downcase %> + <%= link_to t(:digital_download, :type => t("digital_format#{format}")), digital_url(:host => Spree::Config.get(:site_url), :secret => digital_link.secret), :class => "btn #{format}" %> + <% end %> + <% end %> +<% end %> + }, + :disabled => false) diff --git a/config/locales/en.yml b/config/locales/en.yml index 0f5df5e..cb31e2f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -6,5 +6,10 @@ en: broken_file: Warning! this file is broken delete_file_cofirmation: Are you sure you want to delete the file %{filename}? digital_delivery: Digital Delivery + digital_download: Download %{type} ↓ + digital_format: + mp3: Audio MP3 + mobi: Kindle eBook + epub: ePub eBook spree_digital: upload: Upload \ No newline at end of file