fix error when order has no payments (ie not yet complete)

This commit is contained in:
David Cook
2013-06-12 15:40:36 +10:00
parent 415de37a6a
commit 017275f40e

View File

@@ -2,8 +2,10 @@ Deface::Override.new(:virtual_path => "spree/admin/orders/index",
:name => "add_capture_order_shortcut",
:insert_bottom => "[data-hook='admin_orders_index_row_actions']",
#copied from backend / app / views / spree / admin / payments / _list.html.erb:
:text => '<% order.payments.last.actions.grep(/^capture$/).each do |action| %>
<%= link_to_with_icon "icon-#{action}", t(action), fire_admin_order_payment_path(order, order.payments.last, :e => action), :method => :put, :no_text => true, :data => {:action => action} %>
:text => '<% if ! order.payments.empty? %>
<% order.payments.last.actions.grep(/^capture$/).each do |action| %>
<%= link_to_with_icon "icon-#{action}", t(action), fire_admin_order_payment_path(order, order.payments.last, :e => action), :method => :put, :no_text => true, :data => {:action => action} %>
<% end %>
<% end %>'
)