Restrict metadata editing for records

Most of the information is correct via the MusicBrainz API, however
_sometimes_ it's necessary to fix the year or the type of the album
(e.g. because of new releases).
This commit is contained in:
Claudio Ortolina
2024-09-24 09:57:05 +01:00
parent bcb70c9e1b
commit 0b07eaf6a1
4 changed files with 4 additions and 14 deletions
@@ -9,7 +9,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage record records in your database.</:subtitle>
<:subtitle></:subtitle>
</.header>
<.simple_form
@@ -26,17 +26,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
prompt="Choose a value"
options={Ecto.Enum.values(MusicLibrary.Records.Record, :type)}
/>
<.input field={@form[:title]} type="text" label="Title" />
<.input field={@form[:musicbrainz_id]} type="text" label="Musicbrainz" />
<.input field={@form[:year]} type="number" label="Year" />
<.input
field={@form[:genres]}
type="select"
multiple
label="Genres"
options={[{"Option 1", "option1"}, {"Option 2", "option2"}]}
/>
<.input field={@form[:image_url]} type="text" label="Image url" />
<:actions>
<.button phx-disable-with="Saving...">Save Record</.button>
</:actions>
@@ -31,7 +31,7 @@ defmodule MusicLibraryWeb.RecordLive.Index do
defp apply_action(socket, :edit, %{"id" => id}) do
socket
|> assign(:page_title, "Edit Record")
|> assign(:page_title, "Edit Metadata")
|> assign(:record, Records.get_record!(id))
end
@@ -17,7 +17,7 @@ defmodule MusicLibraryWeb.RecordLive.Show do
end
defp page_title(:show), do: "Show Record"
defp page_title(:edit), do: "Edit Record"
defp page_title(:edit), do: "Edit Metadata"
defp musicbrainz_url(record) do
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
@@ -3,7 +3,7 @@
<:subtitle><%= Enum.map(@record.artists, fn a -> a.name end) %></:subtitle>
<:actions>
<.link patch={~p"/records/#{@record}/show/edit"} phx-click={JS.push_focus()}>
<.button>Edit record</.button>
<.button>Edit Metadata</.button>
</.link>
</:actions>
</.header>