Move record actions into menu

This commit is contained in:
Claudio Ortolina
2024-12-12 00:19:32 +03:00
parent 91b81de0f8
commit c3f973b1e1
3 changed files with 178 additions and 88 deletions
@@ -1,6 +1,8 @@
defmodule MusicLibraryWeb.CollectionLive.Show do
use MusicLibraryWeb, :live_view
alias Phoenix.LiveView.JS
alias MusicLibrary.Records
@impl true
@@ -148,4 +150,14 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
defp toggle_actions_menu(record_id) do
JS.toggle(to: "#actions-#{record_id}")
|> JS.toggle_class("pointer-events-none", to: "#records > li")
end
defp close_actions_menu(record_id) do
JS.hide(to: "#actions-#{record_id}")
|> JS.remove_class("pointer-events-none", to: "#records > li")
end
end