From 7fe68372063bfe0f8fc2b63eee8958ac7d9ff280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Tue, 25 Sep 2018 18:41:01 +0200 Subject: [PATCH] Style tables in export all PDF (in same way as in PDF reports) [SCI-2752] --- app/models/project.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 7f39824a1..e72d6ada3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -246,18 +246,24 @@ class Project < ApplicationRecord table_headers = table_vals['headers'] table_headers ||= ('A'..'Z').first(table_data[0].count) - table_el = table_container.add_child('
').first - row_el = table_el.add_child('').first - row_el.add_child('').first + table_el = table_container + .add_child('
').first + + # Add header row + header_el = table_el.add_child('').first + row_el = header_el.add_child('').first + row_el.add_child('
').first table_headers.each do |col| - row_el.add_child("#{col}").first + row_el.add_child("
#{col}
").first end + # Add body rows + body_el = table_el.add_child('').first table_data.each.with_index(1) do |row, index| - row_el = table_el.add_child('').first - row_el.add_child("#{index}").first + row_el = body_el.add_child('').first + row_el.add_child("
#{index}
").first row.each do |col| - row_el.add_child("#{col}").first + row_el.add_child("#{col}").first end end end