Unify sales tax report rendering with others

This commit is contained in:
Maikel Linke
2018-06-06 16:33:53 +10:00
parent 66567fd9e6
commit 6243640bca
3 changed files with 12 additions and 23 deletions

View File

@@ -0,0 +1 @@
%a.edit-order{href: "/admin/orders/#{value}"}= value

View File

@@ -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)

View File

@@ -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"}