aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/table_builder_helper.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb
index 2296af8c7..0a32e528c 100644
--- a/app/helpers/table_builder_helper.rb
+++ b/app/helpers/table_builder_helper.rb
@@ -16,8 +16,17 @@ module TableBuilderHelper
# TODO: add `linked_column` or some such attribute that defines which column should be linked and what method to call to get it
)
- # TODO: Maybe move this to a private method
- head = content_tag :thead do
+
+ content_tag :table,
+ thead(collection, columns, selectable, links) +
+ tbody(collection, columns, selectable, links),
+ class: cls
+ end
+
+ private
+
+ def thead(collection, columns, selectable, links)
+ content_tag :thead do
content_tag :tr do
hcont = []
@@ -43,9 +52,11 @@ module TableBuilderHelper
hcont.join.html_safe
end
end
+ end
+ def tbody(collection, columns, selectable, links)
# TODO: refactor
- body = content_tag :tbody do
+ content_tag :tbody do
collection.collect do |item|
content_tag :tr do
@@ -99,12 +110,8 @@ module TableBuilderHelper
end
end.join.html_safe
end
-
- content_tag :table, head + body, class: cls
end
- private
-
# TODO: `def build_link[s]`
def links_builder(item, actions)
trigger = content_tag :div, class: 'btn dropdown-toggle', data: { toggle: 'dropdown' } do