Extract method in cards table component

This commit is contained in:
Javi Martín
2021-01-06 20:18:10 +01:00
parent 5148919c17
commit 1f6ca4980f
2 changed files with 9 additions and 3 deletions

View File

@@ -2,9 +2,9 @@
<table>
<thead>
<tr>
<th><%= ::Widget::Card.human_attribute_name(:title) %></th>
<th class="small-4"><%= ::Widget::Card.human_attribute_name(:description) %></th>
<th><%= ::Widget::Card.human_attribute_name(:link_text) %> / <%= ::Widget::Card.human_attribute_name(:link_url) %></th>
<th><%= attribute_name(:title) %></th>
<th class="small-4"><%= attribute_name(:description) %></th>
<th><%= attribute_name(:link_text) %> / <%= attribute_name(:link_url) %></th>
<th><%= t("admin.shared.image") %></th>
<th><%= t("admin.shared.actions") %></th>
</tr>

View File

@@ -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