Sha256: ef99c4d46fc25a94d43799ec8f31b34a3ef279139836d39855ffc458c89991cc
Contents?: true
Size: 1.18 KB
Versions: 18
Compression:
Stored size: 1.18 KB
Contents
require_dependency "renalware/pathology" module Renalware module Pathology # Responsible for rendering a HTML table to format historical observation results. # class HistoricalObservationResults::HTMLTableView < SimpleDelegator def render(view_model) header, *body = view_model content_tag(:table, id: "observations") do concat(format_header(header)) concat(format_body(body)) end end private def format_header(cells) content_tag(:thead) do content_tag(:tr) do cells.each do |cell| concat(format_header_cell(cell)) end end end end def format_body(rows) content_tag(:tbody) do rows.each do |row| concat(content_tag(:tr) do row.each do |cell| concat(format_body_cell(cell)) end end) end end end def format_header_cell(cell) content_tag(:th, cell, class: cell.html_class, title: cell.title) end def format_body_cell(cell) content_tag(:td, cell, class: cell.html_class) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems