diff options
| author | Teddy Wing | 2017-06-15 16:21:27 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-15 16:21:27 +0200 |
| commit | c99836b34a0a87de2831cccba583cc3a1502d363 (patch) | |
| tree | c959232f7e937a8dab7d6f6f772dbe443a41966a | |
| parent | 40b02ab0bdbf51ea4c9d3ebef26d880c789edf44 (diff) | |
| download | chouette-core-c99836b34a0a87de2831cccba583cc3a1502d363.tar.bz2 | |
TableBuilder: Move gear menu link creation to a new method
Make this a little more focused and give it a name.
Refs #3479
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 888bd40ad..11616c8e4 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -113,18 +113,7 @@ module TableBuilderHelper CustomLinks.new(item, pundit_user, links).links + item.action_links ).map do |link| - # TODO: make a new method for this - content_tag( - :li, - link_to( - link.href, - method: link.method, - data: link.data - ) do - link.content - end, - class: link.method == :delete ? 'delete-action' : '', - ) + gear_menu_link(link) end.join.html_safe # actions.map do |action| @@ -237,4 +226,18 @@ module TableBuilderHelper def column_is_linkable?(column) column.attribute == 'name' || column.attribute == 'comment' end + + def gear_menu_link(link) + content_tag( + :li, + link_to( + link.href, + method: link.method, + data: link.data + ) do + link.content + end, + class: ('delete-action' if link.method == :delete) + ) + end end |
