diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/decorators/referential_decorator.rb | 3 | ||||
| -rw-r--r-- | app/helpers/links_helper.rb | 5 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 18 |
3 files changed, 18 insertions, 8 deletions
diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index 5112f9dd4..8b3b54f2a 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -39,7 +39,8 @@ class ReferentialDecorator < Draper::Decorator links << Link.new( href: h.referential_path(object), method: :delete, - data: { confirm: h.t('referentials.actions.destroy_confirm') } + data: { confirm: h.t('referentials.actions.destroy_confirm') }, + content: h.destroy_link ) end diff --git a/app/helpers/links_helper.rb b/app/helpers/links_helper.rb new file mode 100644 index 000000000..48cfe9ca4 --- /dev/null +++ b/app/helpers/links_helper.rb @@ -0,0 +1,5 @@ +module LinksHelper + def destroy_link + content_tag(:span, nil, class: 'fa fa-trash') + t('actions.destroy') + end +end diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 4537a0795..af05a7354 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -113,13 +113,17 @@ module TableBuilderHelper CustomLinks.new(item, pundit_user, links).links + item.action_links ).map do |link| - # TODO: ensure the Delete link is formatted correctly with the spacer, - # icon, and label - content_tag :li, link_to( - link.name, - link.href, - method: link.method, - data: link.data + # TODO: make a new method for this + content_tag( + :li, + link_to( + link.href, + method: link.method, + data: link.data + ) do + link.content || link.name + end, + class: link.method == :delete ? 'delete-action' : '', ) end.join.html_safe |
