Hide deliveries column if there are no deliveries

For foodcoops which do not use the delivery feature the column occupies
space in the table, which could be user better with something else.
This commit is contained in:
Patrick Gansterer 2016-03-06 14:01:24 +01:00
parent f5b6fbcf18
commit 7d7dfd7155

View file

@ -10,7 +10,8 @@
%th= heading_helper Invoice, :date %th= heading_helper Invoice, :date
%th= heading_helper Invoice, :paid_on %th= heading_helper Invoice, :paid_on
%th= heading_helper Invoice, :amount %th= heading_helper Invoice, :amount
%th= heading_helper Invoice, :deliveries - if Delivery.any?
%th= heading_helper Invoice, :deliveries
%th= heading_helper Invoice, :orders %th= heading_helper Invoice, :orders
%th= heading_helper Invoice, :note %th= heading_helper Invoice, :note
%th %th
@ -23,10 +24,11 @@
%td= link_to h(format_date invoice.date), finance_invoice_path(invoice) %td= link_to h(format_date invoice.date), finance_invoice_path(invoice)
%td= format_date invoice.paid_on %td= format_date invoice.paid_on
%td= number_to_currency invoice.amount %td= number_to_currency invoice.amount
%td>< - if Delivery.any?
- invoice.deliveries.each_with_index do |delivery, index| %td><
= ', ' if index > 0 - invoice.deliveries.each_with_index do |delivery, index|
= link_to format_date(delivery.delivered_on), [delivery.supplier,delivery] = ', ' if index > 0
= link_to format_date(delivery.delivered_on), [delivery.supplier,delivery]
%td>< %td><
- invoice.orders.each_with_index do |order, index| - invoice.orders.each_with_index do |order, index|
= ', ' if index > 0 = ', ' if index > 0