Turn anemic partial into a helper method
This commit is contained in:
@@ -21,4 +21,12 @@ module WebhooksHelper
|
||||
def webhook_action_label(action)
|
||||
ACTION_LABELS[action] || action.to_s.humanize
|
||||
end
|
||||
|
||||
def link_to_webhooks(collection, &)
|
||||
link_to collection_webhooks_path(collection_id: collection),
|
||||
class: [ "btn", { "btn--reversed": collection.webhooks.any? } ],
|
||||
data: { controller: "tooltip" } do
|
||||
icon_tag("world") + tag.span("Webhooks", class: "for-screen-reader")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<%= link_to collection_webhooks_path(collection_id: collection), class: ["btn", {"btn--reversed": collection.webhooks.any?}], data: { controller: "tooltip" } do %>
|
||||
<%= icon_tag "world" %>
|
||||
<span class="for-screen-reader">Webhooks</span>
|
||||
<% end %>
|
||||
@@ -13,7 +13,7 @@
|
||||
<%= render "filters/menu" %>
|
||||
|
||||
<div class="header__actions header__actions--start">
|
||||
<%= render "cards/webhooks", collection: @collection if Current.user.admin? %>
|
||||
<%= link_to_webhooks(@collection) if Current.user.admin? %>
|
||||
</div>
|
||||
|
||||
<h1 class="header__title divider divider--fade full-width">
|
||||
|
||||
Reference in New Issue
Block a user