Module: Grapple::Helpers::TableHelper

Defined in:
lib/grapple/helpers/table_helper.rb

Constant Summary collapse

@@builder =
Grapple::DataGridBuilder

Instance Method Summary collapse

Instance Method Details

#grapple_container(*args, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grapple/helpers/table_helper.rb', line 8

def grapple_container(*args, &block)
	options = args[0] || {}
	builder_class = options[:builder] || @@builder
	container_attr = builder_class.container_attributes(self, options)
	html = ''
	html << builder_class.before_container(self, options)
	html << tag('div', container_attr, false) + "\n"
	html << capture(&block)
	html << "</div>\n"
	html << builder_class.after_container(self, options)
	return html.html_safe
end

#table_for(columns, records, *args, &block) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/grapple/helpers/table_helper.rb', line 21

def table_for(columns, records, *args, &block)
	options = args[0] || {}
	builder_class = options[:builder] || @@builder
	builder = builder_class.new(self, columns, records, params, options)
	output = capture(builder, &block)
	(builder.before_table + builder.table(output) + builder.after_table).html_safe
end