From 1f6ca4980fb004b9ffc0804d8d11ed5354391c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 6 Jan 2021 20:18:10 +0100 Subject: [PATCH] Extract method in cards table component --- app/components/admin/widget/cards/table_component.html.erb | 6 +++--- app/components/admin/widget/cards/table_component.rb | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/admin/widget/cards/table_component.html.erb b/app/components/admin/widget/cards/table_component.html.erb index 01a52aec5..d7fc9e579 100644 --- a/app/components/admin/widget/cards/table_component.html.erb +++ b/app/components/admin/widget/cards/table_component.html.erb @@ -2,9 +2,9 @@ - - - + + + diff --git a/app/components/admin/widget/cards/table_component.rb b/app/components/admin/widget/cards/table_component.rb index 74e2112a3..eba23de30 100644 --- a/app/components/admin/widget/cards/table_component.rb +++ b/app/components/admin/widget/cards/table_component.rb @@ -5,4 +5,10 @@ class Admin::Widget::Cards::TableComponent < ApplicationComponent @cards = cards @no_cards_message = no_cards_message end + + private + + def attribute_name(attribute) + ::Widget::Card.human_attribute_name(attribute) + end end
<%= ::Widget::Card.human_attribute_name(:title) %><%= ::Widget::Card.human_attribute_name(:description) %><%= ::Widget::Card.human_attribute_name(:link_text) %> / <%= ::Widget::Card.human_attribute_name(:link_url) %><%= attribute_name(:title) %><%= attribute_name(:description) %><%= attribute_name(:link_text) %> / <%= attribute_name(:link_url) %> <%= t("admin.shared.image") %> <%= t("admin.shared.actions") %>