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:
@@ -9,7 +9,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
|
|||||||
<div>
|
<div>
|
||||||
<.header>
|
<.header>
|
||||||
<%= @title %>
|
<%= @title %>
|
||||||
<:subtitle>Use this form to manage record records in your database.</:subtitle>
|
<:subtitle></:subtitle>
|
||||||
</.header>
|
</.header>
|
||||||
|
|
||||||
<.simple_form
|
<.simple_form
|
||||||
@@ -26,17 +26,7 @@ defmodule MusicLibraryWeb.RecordLive.FormComponent do
|
|||||||
prompt="Choose a value"
|
prompt="Choose a value"
|
||||||
options={Ecto.Enum.values(MusicLibrary.Records.Record, :type)}
|
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[: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>
|
<:actions>
|
||||||
<.button phx-disable-with="Saving...">Save Record</.button>
|
<.button phx-disable-with="Saving...">Save Record</.button>
|
||||||
</:actions>
|
</:actions>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ defmodule MusicLibraryWeb.RecordLive.Index do
|
|||||||
|
|
||||||
defp apply_action(socket, :edit, %{"id" => id}) do
|
defp apply_action(socket, :edit, %{"id" => id}) do
|
||||||
socket
|
socket
|
||||||
|> assign(:page_title, "Edit Record")
|
|> assign(:page_title, "Edit Metadata")
|
||||||
|> assign(:record, Records.get_record!(id))
|
|> assign(:record, Records.get_record!(id))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ defmodule MusicLibraryWeb.RecordLive.Show do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp page_title(:show), do: "Show Record"
|
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
|
defp musicbrainz_url(record) do
|
||||||
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<:subtitle><%= Enum.map(@record.artists, fn a -> a.name end) %></:subtitle>
|
<:subtitle><%= Enum.map(@record.artists, fn a -> a.name end) %></:subtitle>
|
||||||
<:actions>
|
<:actions>
|
||||||
<.link patch={~p"/records/#{@record}/show/edit"} phx-click={JS.push_focus()}>
|
<.link patch={~p"/records/#{@record}/show/edit"} phx-click={JS.push_focus()}>
|
||||||
<.button>Edit record</.button>
|
<.button>Edit Metadata</.button>
|
||||||
</.link>
|
</.link>
|
||||||
</:actions>
|
</:actions>
|
||||||
</.header>
|
</.header>
|
||||||
|
|||||||
Reference in New Issue
Block a user