Class: RenderTable::Table

Inherits:
Base
  • Object
show all
Defined in:
lib/render_table/table.rb

Instance Attribute Summary

Attributes inherited from Base

#header, #html, #options, #override, #records, #table_class, #table_id

Instance Method Summary collapse

Methods inherited from Base

#context, #initialize, render, #render, #rows

Constructor Details

This class inherits a constructor from RenderTable::Base

Instance Method Details

#templateObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/render_table/table.rb', line 2

def template
  "    <table id=\"<%= table.table_id %>\" class=\"<%= table.table_class %>\">\n      <thead>\n        <tr>\n          <% table.header.each do |header| %>\n            <th><%= header.to_s %></th>\n          <% end %>\n          <% if table.options %>\n            <th></th>\n          <% end %>\n        </tr>\n      </thead>\n      <tbody>\n      <% table.rows.each do |row| %>\n        <tr id=\"<%= row.id %>\" class=\"<%= row.class %>\">\n          <% row.cells.each do |cell| %>\n            <td id=\"<%= cell.id %>\" class=\"<%= cell.class %>\">\n              <%= cell.value %>\n            </td>\n          <% end %>\n          <% if table.options %>\n            <td><%= options_cell(row.record, row.row_index) %></td>\n          <% end %>\n        </tr>\n      <% end %>\n      </tbody>\n    </table>\n  HTML\nend\n"