uploads: change loading indicator for thumbnails.
Use a spinner icon instead of the word "Loading" for thumbnails that are being processed in the background in a batch upload. Also use morphdom to update thumbnails so we only update the parts of the DOM that actually changed.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<% if upload_media_asset.failed? %>
|
||||
Failed
|
||||
<% else %>
|
||||
Loading
|
||||
<%= spinner_icon(class: "animate-spin h-8") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<% @upload_media_assets.each do |upload_media_asset| %>
|
||||
$(".upload-media-asset-preview[data-id=<%= upload_media_asset.id %>]").replaceWith("<%= j render("upload_media_assets/preview", upload_media_asset: upload_media_asset, size: params.fetch(:size, 180)) %>");
|
||||
$(function() {
|
||||
let $el = $(".upload-media-asset-preview[data-id=<%= upload_media_asset.id %>]").get(0);
|
||||
let html = "<%= j render("upload_media_assets/preview", upload_media_asset: upload_media_asset, size: params.fetch(:size, 180)) %>";
|
||||
morphdom($el, html);
|
||||
});
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user