8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/custom_form_generator/helpers/table_renderer.rb', line 8
def table_template
<<-SLIM
table
tr
- @table_yaml.each do |field|
th id=CGI.escapeHTML(field["id"]) class=CGI.escapeHTML(field["class"]) = field['label']
th Activities
- data.each do |entry|
tr
- @table_yaml.each do |field|
td id=CGI.escapeHTML(field["id"]) class=CGI.escapeHTML(field["class"])
- value = entry.dig(*field['key'].split('.'))
- if field['key'] == 'properties.published_at' && value.nil?
| false
- elsif field['key'] == 'properties.image_url' && value.nil?
img src='/path/to/default_image.jpg' alt='Default Thumbnail'
- else
= value
td
button class='edit-button' data-id=entry['_id']['$oid'] Edit
button class='delete-button' data-id=entry['_id']['$oid'] Delete
SLIM
end
|