diff --git a/app/views/spree/admin/reports/_link_order.html.haml b/app/views/spree/admin/reports/_link_order.html.haml new file mode 100644 index 0000000000..9f0b72b4f7 --- /dev/null +++ b/app/views/spree/admin/reports/_link_order.html.haml @@ -0,0 +1 @@ +%a.edit-order{href: "/admin/orders/#{value}"}= value diff --git a/app/views/spree/admin/reports/_table.html.haml b/app/views/spree/admin/reports/_table.html.haml index 11fed58584..d0c4af8a5d 100644 --- a/app/views/spree/admin/reports/_table.html.haml +++ b/app/views/spree/admin/reports/_table.html.haml @@ -1,15 +1,21 @@ +- column_partials ||= {} %br %br %table{id: id} %thead %tr - @header.each do |heading| - %th=heading + %th= heading %tbody - @table.each do |row| %tr - - row.each do |column| - %td= column + - row.each_with_index do |cell_value, column_index| + %td + - partial = column_partials[column_index] + - if partial + = render partial, value: cell_value + - else + = cell_value - if @table.empty? %tr - %td{:colspan => "2"}= t(:none) + %td{colspan: @header.count}= t(:none) diff --git a/app/views/spree/admin/reports/sales_tax.html.haml b/app/views/spree/admin/reports/sales_tax.html.haml index 9971b2c5cb..d64f73ec4d 100644 --- a/app/views/spree/admin/reports/sales_tax.html.haml +++ b/app/views/spree/admin/reports/sales_tax.html.haml @@ -16,22 +16,4 @@ %br = button t(:search) -%br -%br -%table#listing_orders.index - %thead - %tr{'data-hook' => "orders_header"} - - @report.header.each do |heading| - %th= heading - %tbody - - @report.table.each do |row| - %tr - - row.each_with_index do |column, i| - - if i == 0 - %td - %a.edit-order{'href' => "/admin/orders/#{column}"}= column - - else - %td= column - - if @report.table.empty? - %tr - %td{:colspan => @report.header.count}= t(:none) += render "table", id: "listing_orders", column_partials: {0 => "link_order"}