Skip to content

Commit

Permalink
Merge branch 'release/0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo0807 committed Dec 11, 2024
2 parents adee12d + 2814166 commit 009c8f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
20 changes: 20 additions & 0 deletions lib/backpex/item_actions/item_action.ex
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,24 @@ defmodule Backpex.ItemAction do

module.fields() != []
end

@doc """
Returns default item actions.
"""
def default_actions do
[
show: %{
module: Backpex.ItemActions.Show,
only: [:row]
},
edit: %{
module: Backpex.ItemActions.Edit,
only: [:row, :show]
},
delete: %{
module: Backpex.ItemActions.Delete,
only: [:row, :index, :show]
}
]
end
end
19 changes: 1 addition & 18 deletions lib/backpex/live_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ defmodule Backpex.LiveResource do
end

defp apply_item_actions(socket, action) when action in [:index, :resource_action] do
item_actions = socket.assigns.live_resource.item_actions(default_item_actions())
item_actions = Backpex.ItemAction.default_actions() |> socket.assigns.live_resource.item_actions()
assign(socket, :item_actions, item_actions)
end

Expand Down Expand Up @@ -1575,23 +1575,6 @@ defmodule Backpex.LiveResource do
if value in permitted, do: value, else: default
end

defp default_item_actions do
[
show: %{
module: Backpex.ItemActions.Show,
only: [:row]
},
edit: %{
module: Backpex.ItemActions.Edit,
only: [:row, :show]
},
delete: %{
module: Backpex.ItemActions.Delete,
only: [:row, :index, :show]
}
]
end

defp maybe_put_empty_filter(%{} = filters, empty_filter_key) when filters == %{} do
Map.put(filters, Atom.to_string(empty_filter_key), true)
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Backpex.MixProject do
use Mix.Project

@version "0.9.0"
@version "0.9.1"

@source_url "https://github.com/naymspace/backpex"
@changelog_url "https://github.com/naymspace/backpex/releases"
Expand Down

0 comments on commit 009c8f3

Please sign in to comment.