uploads: fix related tags error on multi-file upload page.

Fix the related tags Javascript trying to run on the multi-file upload
page. It should only run on the single-file upload page.
This commit is contained in:
evazion
2022-02-15 00:53:36 -06:00
parent 36265dbff0
commit e0ed6391f5
4 changed files with 11 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ RelatedTag.initialize_all = function() {
// Show the related tags automatically when the "Edit" tab is opened, or by default on the uploads page.
$(document).on("danbooru:open-post-edit-tab", RelatedTag.show);
if ($("#c-uploads #a-show").length) {
if ($("#c-uploads #a-show #p-single-asset-upload").length) {
RelatedTag.show();
}
}

View File

@@ -7,7 +7,7 @@ Upload.IQDB_MIN_SIMILARITY = 50;
Upload.IQDB_HIGH_SIMILARITY = 70;
Upload.initialize_all = function() {
if ($("#c-uploads #a-show").length) {
if ($("#c-uploads #a-show #p-single-asset-upload").length) {
this.initialize_similar();
$("#toggle-artist-commentary").on("click.danbooru", function(e) {

View File

@@ -2,7 +2,9 @@
<div id="a-show">
<h1>Upload</h1>
<%= render "uploads/single_asset_upload", upload_media_asset: @upload_media_asset %>
<div id="p-single-asset-upload">
<%= render "uploads/single_asset_upload", upload_media_asset: @upload_media_asset %>
</div>
</div>
</div>

View File

@@ -7,9 +7,13 @@
<% elsif @upload.media_asset_count == 0 %>
<p>Processing upload...</p>
<% elsif @upload.media_asset_count > 1 %>
<%= render "multiple_asset_upload", upload: @upload %>
<div id="p-multiple-asset-upload">
<%= render "multiple_asset_upload", upload: @upload %>
</div>
<% elsif @upload.media_asset_count == 1 %>
<%= render "single_asset_upload", upload_media_asset: @upload.upload_media_assets.first %>
<div id="p-single-asset-upload">
<%= render "single_asset_upload", upload_media_asset: @upload.upload_media_assets.first %>
</div>
<% end %>
</div>
</div>