app/views/spina/admin/attachments/_attachment.html.erb in spina-2.9.1 vs app/views/spina/admin/attachments/_attachment.html.erb in spina-2.10.0
- old
+ new
@@ -3,9 +3,18 @@
<turbo-frame id="<%= dom_id(attachment) %>_filename" class="font-medium text-gray-800 h-full flex-1 w-56 text-sm flex items-center relative">
<span class="truncate"><%= attachment.file.filename %></span>
<div class="absolute h-full opacity-0 group-hover:opacity-100 flex items-center right-0 pr-3 top-0">
+ <%= form_with model: attachment, url: spina.admin_attachment_path(attachment), data: {turbo_frame: dom_id(attachment), controller: "form loading-button", loading_message: t('spina.media_library.uploading'), action: "turbo:submit-end->loading-button#doneLoading"} do |f| %>
+ <%= f.file_field :file, id: "attachment_#{attachment.id}_file_field", class: 'hidden', data: {action: "loading-button#loading form#requestSubmit"} %>
+
+ <button type="button" class="btn btn-default h-7 px-2 mr-2 text-xs" data-controller="delegate-click" data-action="delegate-click#click" data-loading-button-target="button" data-delegate-click-target="#attachment_<%= attachment.id %>_file_field">
+ <%= heroicon("upload", style: :solid, class: "w-4 h-4 mr-1 text-gray-600") %>
+ <%=t 'spina.ui.replace' %>
+ </button>
+ <% end %>
+
<%= link_to spina.edit_admin_attachment_path(attachment), class: "btn btn-default h-7 px-2 mr-2 text-xs" do %>
<%= heroicon('pencil', style: :solid, class: 'w-4 h-4 mr-1 text-gray-600') %>
<%=t 'spina.ui.rename' %>
<% end %>
\ No newline at end of file