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