Class: Grapple::HtmlTableBuilder
- Inherits:
-
BaseTableBuilder
- Object
- BaseTableBuilder
- Grapple::HtmlTableBuilder
- Defined in:
- lib/grapple/html_table_builder.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseTableBuilder
#columns, #namespace, #params, #records, #template
Instance Method Summary collapse
-
#after_container ⇒ Object
HTML to render after the container.
-
#before_container ⇒ Object
HTML to render before the container.
-
#container(inner_html) ⇒ Object
Wrap the table in a div.
-
#container_attributes ⇒ Object
HTML attributes for the container.
- #table(content, attributes = {}) ⇒ Object
Methods inherited from BaseTableBuilder
#after_table, #before_table, configure, #default_options, helper, #initialize
Constructor Details
This class inherits a constructor from Grapple::BaseTableBuilder
Instance Method Details
#after_container ⇒ Object
HTML to render after the container
39 40 41 |
# File 'lib/grapple/html_table_builder.rb', line 39 def after_container '' end |
#before_container ⇒ Object
HTML to render before the container
34 35 36 |
# File 'lib/grapple/html_table_builder.rb', line 34 def before_container '' end |
#container(inner_html) ⇒ Object
Wrap the table in a div
18 19 20 21 22 23 24 25 26 |
# File 'lib/grapple/html_table_builder.rb', line 18 def container(inner_html) html = '' html << before_container html << template.tag('div', container_attributes, true) + "\n" html << inner_html html << "</div>\n" html << after_container return html.html_safe end |
#container_attributes ⇒ Object
HTML attributes for the container
29 30 31 |
# File 'lib/grapple/html_table_builder.rb', line 29 def container_attributes { class: 'grapple' } end |
#table(content, attributes = {}) ⇒ Object
13 14 15 |
# File 'lib/grapple/html_table_builder.rb', line 13 def table(content, attributes = {}) "#{template.content_tag('table', content, attributes)}\n".html_safe end |