Skip to content

Commit

Permalink
Display filename of existing cover on album form
Browse files Browse the repository at this point in the history
c.f. what we're doing for the track original files in the same form.

We might want to try to extract the duplication, but I'm a bit unsure
how to do that with the current `TailwindFormBuilder` implementation. We
could probably do it in a helper method, but that doesn't feel quite
right either.

We might also want to consider doing this for the profile picture file
field on the artist form, but I'm trying to keep this PR focussed on the
album form.
  • Loading branch information
floehopper committed Dec 22, 2023
1 parent be603c1 commit 3aaec28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/views/albums/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<%= form.currency_field :price, symbol: '£', class: 'w-full mb-2' %>
<%= form.text_area :about, rows: 10, class: 'w-full mb-3' %>
<%= form.text_area :credits, rows: 10, class: 'w-full mb-3' %>
<%= form.labels :cover %>
<% if form.object.cover.attached? %>
<%= form.labels :cover, text: "Cover (#{form.object.cover.filename})" %>
<% else %>
<%= form.labels :cover, text: "Cover" %>
<% end %>
<%= form.file_field :cover, accept: 'image/jpeg,image/png', class: 'block border border-slate-200 mb-3 file:mr-3 file:px-3 file:py-3 w-full file:border-0 file:bg-amber-600 hover:file:bg-amber-500 file:text-white' %>
<div class="flex items-center gap-2 mb-4">
<span class="text-amber-600">
Expand Down

0 comments on commit 3aaec28

Please sign in to comment.