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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/interview/controls/grid.rb', line 7
def build(b)
objects = @objects || find_attribute!(:objects)
@object = find_attribute!(:object)
sortable_id = "sortable_#{@object.class.model_name.plural}" if @sortable
b.section style: 'table', html_class: 'table' do
b.section style: 'thead' do
b.section style: 'tr' do
b.section style: 'th' if @sortable
@build_captions = true
b.meta_control pointer: self do
yield if block_given?
end
end
end
html_opts = {}
html_opts[:id] = sortable_id if @sortable
b.section style: 'tbody', html_options: html_opts do
objects.each do |object|
@object = object
html_opts = {}
html_opts[:id] = "#{sortable_id}_#{object.id}" if @sortable
b.section style: 'tr', htl_options: html_opts do
if @sortable
b.section style: 'td' do
b.glyphicon style: 'resize-vertical', html_class: 'handle'
end
end
@build_captions = false
b.meta_control pointer: self do
yield if block_given?
end
end
end
end
end
if objects.empty?
b.text text: "Keine #{@object.class.human_name(count: 2)} vorhanden.", style: 'p',
html_class: 'text-center text-muted'
end
end
|