uploads: allow changing thumbnail size on My Uploads / All Uploads pages.

* Add a "Size" menu to the My Uploads / All Uploads pages to allow
  changing the thumbnail size.
* Make the My Uploads / All Uploads pages use the same thumbnail size as
  the post index page.
* Change the "Gallery | Table" links on the My Uploads page to icons.
This commit is contained in:
evazion
2022-02-16 14:11:02 -06:00
parent f890e8595e
commit 0b8d042c06
19 changed files with 127 additions and 91 deletions

View File

@@ -1,18 +1,9 @@
<div class="flex items-center mb-2">
<h1 class="flex-1">My Uploads</h1>
<span>
<strong>Gallery</strong> |
<%= link_to "Table", user_uploads_path(CurrentUser.user.id.to_i, mode: "table") %>
</span>
</div>
<%= render(MediaAssetGalleryComponent.new) do |gallery| %>
<% @uploads.each do |upload| %>
<%= render(MediaAssetGalleryComponent.new(size: size)) do |gallery| %>
<% uploads.each do |upload| %>
<% gallery.media_asset do %>
<%= render "uploads/preview", upload: upload, size: gallery.size %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@uploads) %>
<%= numbered_paginator(uploads) %>

View File

@@ -1,4 +1,4 @@
<%= render(MediaAssetGalleryComponent.new(classes: ["upload-media-asset-gallery"])) do |gallery| %>
<%= render(MediaAssetGalleryComponent.new(size: size, classes: ["upload-media-asset-gallery"])) do |gallery| %>
<% upload.upload_media_assets.order(id: :asc).each do |upload_media_asset| %>
<% gallery.media_asset do %>
<%= render "upload_media_assets/preview", upload_media_asset: upload_media_asset, size: gallery.size %>

View File

@@ -1,13 +1,4 @@
<div class="flex items-center mb-2">
<h1 class="flex-1">My Uploads</h1>
<span>
<%= link_to "Gallery", user_uploads_path(CurrentUser.user.id.to_i) %> |
<strong>Table</strong>
</span>
</div>
<%= table_for @uploads, class: "striped", width: "100%" do |t| %>
<%= table_for uploads, class: "striped", width: "100%" do |t| %>
<% t.column "Upload", td: { class: "text-center" } do |upload| %>
<%= render "uploads/preview", upload: upload, size: "180" %>
<% end %>
@@ -61,4 +52,4 @@
<% end %>
<% end %>
<%= numbered_paginator(@uploads) %>
<%= numbered_paginator(uploads) %>

View File

@@ -1,9 +1,23 @@
<div id="c-uploads">
<div id="a-index">
<div class="flex items-center mb-4">
<h1 class="flex-1">My Uploads</h1>
<span>
<%= render PreviewSizeMenuComponent.new(current_size: @preview_size) %>
<% if @mode == "table" %>
<%= link_to grid_icon, current_page_path(mode: nil), title: "Gallery", class: "inactive-link" %>
<% else %>
<%= link_to list_icon, current_page_path(mode: "table"), title: "Table", class: "inactive-link" %>
<% end %>
</span>
</div>
<% if @mode == "gallery" %>
<%= render "uploads/gallery" %>
<%= render "uploads/gallery", uploads: @uploads, size: @preview_size %>
<% elsif @mode == "table" %>
<%= render "uploads/table" %>
<%= render "uploads/table", uploads: @uploads %>
<% end %>
</div>
</div>

View File

@@ -1,6 +1,12 @@
<div id="c-uploads">
<div id="a-show">
<h1>Upload</h1>
<div class="flex mb-4">
<h1 class="flex-grow-1">Upload</h1>
<% if @upload.media_asset_count > 1 %>
<%= render PreviewSizeMenuComponent.new(current_size: @preview_size) %>
<% end %>
</div>
<% if @upload.is_errored? %>
<p>Error: <%= @upload.error %>.</p>
@@ -12,7 +18,7 @@
<% end %>
<% elsif @upload.media_asset_count > 1 %>
<div id="p-multiple-asset-upload">
<%= render "multiple_asset_upload", upload: @upload %>
<%= render "multiple_asset_upload", upload: @upload, size: @preview_size %>
</div>
<% elsif @upload.media_asset_count == 1 %>
<div id="p-single-asset-upload">