Fix bug in 2c0feaf94 that caused all the assets on the /uploads?mode=gallery
page to show the same source. The loop clobbered the `@upload` variable
such that the value from the last iteration was used by all assets.
35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
<div class="flex items-center mb-2">
|
|
<h1 class="flex-1">My Uploads</h1>
|
|
|
|
<span>
|
|
<strong>Gallery</strong> |
|
|
<%= link_to "Table", uploads_path(mode: "table") %>
|
|
</span>
|
|
</div>
|
|
|
|
<%= render(MediaAssetGalleryComponent.new) do |gallery| %>
|
|
<% @media_assets.each do |media_asset| %>
|
|
<% upload = media_asset.uploads.order(id: :desc).select { |upload| upload.uploader == CurrentUser.user }.first %>
|
|
|
|
<% gallery.media_asset(media_asset: media_asset, size: gallery.size, link_target: media_asset.post || upload) do |preview| %>
|
|
<% preview.footer do %>
|
|
<div class="text-center text-muted text-xs h-12">
|
|
<% if media_asset.post.present? %>
|
|
<div class="leading-none">
|
|
<%= link_to "post ##{media_asset.post.id}", media_asset.post, class: "leading-none" %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if upload.source.present? %>
|
|
<%= external_link_to upload.source, Addressable::URI.parse(upload.source).domain %>
|
|
<% else %>
|
|
<em>No source</em>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%= numbered_paginator(@media_assets) %>
|