Replies: 1 comment
-
Hey, there is no easy way to do this at the moment. You could use the Backpex slots API to add an item action manually to the show page, for example by overwriting the @impl Backpex.LiveResource
def render_resource_slot(assigns, :show, :page_title) do
~H"""
<Backpex.HTML.Layout.main_title class="flex items-center justify-between">
{@singular_name}
<.link
:if={@live_action == :show and @live_resource.can?(assigns, :edit, @item)}
class="tooltip"
data-tip={Backpex.translate("Edit")}
aria-label={Backpex.translate("Edit")}
patch={Backpex.Router.get_path(@socket, @live_resource, @params, :edit, @item)}
>
<Backpex.HTML.CoreComponents.icon
name="hero-pencil-square"
class="h-6 w-6 cursor-pointer transition duration-75 hover:scale-110 hover:text-blue-600"
/>
</.link>
<%!-- Add another action here --%>
</Backpex.HTML.Layout.main_title>
"""
end Of course, it would be better to display item actions on show views automatically, as it was documented in the linked PR. For example: @impl Backpex.LiveResource
def item_actions(_default_actions) do
[
duplicate: %{
module: DemoWeb.ItemActions.DuplicateTag,
only: [:row]
}
]
end Are you interested in submitting a pull request for this feature? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I saw this entry PR #591 from six month ago which pretty much the feature I'm after.
I would like to show specific item actions on the show page instead of the index. Is there a way to do this at the moment?
Beta Was this translation helpful? Give feedback.
All reactions