Class: Trestle::Table::Renderer
- Inherits:
-
Object
- Object
- Trestle::Table::Renderer
- Defined in:
- lib/trestle/table.rb
Instance Method Summary collapse
- #classes ⇒ Object
- #columns ⇒ Object
- #data ⇒ Object
- #id ⇒ Object
-
#initialize(table, template) ⇒ Renderer
constructor
A new instance of Renderer.
- #row ⇒ Object
Constructor Details
#initialize(table, template) ⇒ Renderer
Returns a new instance of Renderer.
52 53 54 |
# File 'lib/trestle/table.rb', line 52 def initialize(table, template) @table, @template = table, template end |
Instance Method Details
#classes ⇒ Object
68 69 70 |
# File 'lib/trestle/table.rb', line 68 def classes ["trestle-table", [:class]].compact end |
#columns ⇒ Object
60 61 62 |
# File 'lib/trestle/table.rb', line 60 def columns @columns ||= row.columns end |
#data ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/trestle/table.rb', line 72 def data data = [:data] || {} controllers = Array(data[:controller]) controllers << "checkbox-select" data.merge(controller: controllers.join(" ")) end |
#id ⇒ Object
64 65 66 |
# File 'lib/trestle/table.rb', line 64 def id [:id] end |
#row ⇒ Object
56 57 58 |
# File 'lib/trestle/table.rb', line 56 def row @row ||= @table.row.renderer(table: @table, template: @template) end |