We were using the same logic in four different places, so we're creating a new class to handle that logic. Note that I didn't find a way to delegate the `content` method to a `Admin::TableActionsComponent`, so we're delegating the `action` method instead. That means we need to create a method returning an `Admin::TableActionsComponent`. We also need to cache this object; otherwise we were getting an error when calling `actions.action` from the `Admin::Poll::Questions::TableActionsComponent`.
4 lines
163 B
Plaintext
4 lines
163 B
Plaintext
<%= render Admin::AllowedTableActionsComponent.new(question) do |actions| %>
|
|
<%= actions.action(:answers, text: t("admin.polls.show.edit_answers")) %>
|
|
<% end %>
|