From ef5bf42fc266fb52f72733fbeb37dc667ebb1851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Tue, 25 Sep 2018 19:35:39 +0200 Subject: [PATCH] Refactor table styling for export all PDF; remove 'min-width' from table cells to also display bigger tables nicely --- app/models/project.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index e72d6ada3..da266594d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -250,20 +250,26 @@ class Project < ApplicationRecord .add_child('
').first # Add header row + header_cell = ''\ + '
'\ + '%s'\ + '
'\ + '' header_el = table_el.add_child('').first row_el = header_el.add_child('').first - row_el.add_child('
').first + row_el.add_child(format(header_cell, '')).first table_headers.each do |col| - row_el.add_child("
#{col}
").first + row_el.add_child(format(header_cell, col)).first end # Add body rows + body_cell = '%s' body_el = table_el.add_child('').first - table_data.each.with_index(1) do |row, index| + table_data.each.with_index(1) do |row, idx| row_el = body_el.add_child('').first - row_el.add_child("
#{index}
").first + row_el.add_child(format(header_cell, idx)).first row.each do |col| - row_el.add_child("#{col}").first + row_el.add_child(format(body_cell, col)).first end end end