Sha256: 41802b0c6d503931b327544c59f8effa9d0502daf9d1aab07cb5a81e178c824d

Contents?: true

Size: 910 Bytes

Versions: 19

Compression:

Stored size: 910 Bytes

Contents

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    # Reponsible for rendering a HTML table for recent observation results.
    #
    class RecentObservationResults::HTMLTableView < SimpleDelegator
      def render(view_model)
        content_tag(:table, id: "observations") do
          format_body(view_model)
        end
      end

      private

      def format_body(rows)
        rows.each do |row|
          header, *values = row
          concat(content_tag(:tr) do
            format_row(header, values)
          end)
        end
      end

      def format_row(header, values)
        content_tag(:td, title: header.title) do
          concat(header)
          values.each do |cell|
            concat(format_cell(cell))
          end
        end
      end

      def format_cell(cell)
        content_tag(:td, cell, class: cell.html_class)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc9 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc8 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc7 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc6 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc5 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc4 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc3 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.rc1 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta12 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/pathology/recent_observation_results/html_table_view.rb