Improve cover upload input

- Enable drag and drop (invisible)
- Show upload progress
- Add relevant tests
This commit is contained in:
Claudio Ortolina
2024-10-04 12:07:00 +01:00
parent d191ff50fd
commit ec0a96087c
4 changed files with 72 additions and 5 deletions
+6 -2
View File
@@ -31,7 +31,11 @@ defmodule MusicLibrary.RecordsFixtures do
"Thick as a Brick"
]
# While it would be great to have this random, it's ok to use one single image
@cover_data_path "#{__DIR__}/marillion-marbles.jpg"
@marbles_cover_data_path "#{__DIR__}/marillion-marbles.jpg"
@raven_cover_data_path "#{__DIR__}/steven-wilson-raven.jpg"
def marbles_cover_fixture, do: @marbles_cover_data_path
def raven_cover_fixture, do: @raven_cover_data_path
def record_fixture(attrs \\ %{}) do
musicbrainz_id = Ecto.UUID.generate()
@@ -41,7 +45,7 @@ defmodule MusicLibrary.RecordsFixtures do
|> Enum.into(%{
genres: Enum.take_random(@genres, :rand.uniform(3)),
cover_url: "https://coverartarchive.org/release-group/#{musicbrainz_id}/front",
cover_data: File.read!(@cover_data_path),
cover_data: File.read!(@marbles_cover_data_path),
musicbrainz_id: musicbrainz_id,
title: Enum.random(@titles),
type: :album,
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB