aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorTeddy Wing2017-06-08 14:31:51 +0200
committerTeddy Wing2017-06-08 14:31:51 +0200
commit1ea3187de06cb159faf0f773c50263dd69eafaa8 (patch)
tree86d29ec35214843439756433469ed955d7343f1c /app/helpers
parent71611d2d4ffd5a1d6569acd0cae703ed22c55ed5 (diff)
downloadchouette-core-1ea3187de06cb159faf0f773c50263dd69eafaa8.tar.bz2
TableBuilder: Ideas for method arguments
A couple of ideas for new method arguments. Didn't like `cls:`, but not a fan of avoiding the name just for looks if the alternative is messy. Don't like the fact that `current_referential` comes in as a global to a couple parts of the builder. Ideally want to be explicit about that it is and where it comes from. Unfortunately, it's rather convoluted and dynamic, designed to abstract away the difference between different models' referentials. And it's connected to `parent` (very dynamic) via the `inherited_resources` gem, which means that refactoring it out would create a huge mess of changes. Not anxious to board that ship just yet. Do we want to pass `current_referential` in directly and just make the tests easier to write? Would it be a pain to pass it in every time from the caller? I don't know yet. Still trying to figure out the best course of action there. Refs #3479
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/table_builder_helper.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb
index 54f6833e7..161ffb17c 100644
--- a/app/helpers/table_builder_helper.rb
+++ b/app/helpers/table_builder_helper.rb
@@ -3,12 +3,14 @@ module TableBuilderHelper
def table_builder_2(
collection,
columns,
+ current_referential: nil,
sortable: true,
selectable: false, # TODO: is this necessary?
# selection_actions: [] ## this has been gotten rid of. The element based on this should be created elsewhere
links: [], # links: or actions: ? I think 'links' is better since 'actions' evokes Rails controller actions and we want to put `link_to`s here
sort_by: {}, # { column: 'name', direction: 'desc' }
cls: '' # can we rename this to "class"?
+ # ^^ rename to html_options = {} at the end of the non-keyword arguments? Hrm, not a fan of combining hash args and keyword args
# sort column
# sort direction