On the upload page, change the file size info beneath the image to be formatted the same way as on the media assets page, and to include a menu with links to offsite reverse image search tools.
153 lines
6.6 KiB
Plaintext
153 lines
6.6 KiB
Plaintext
<% if CurrentUser.user.upload_limit.limited? %>
|
|
<p>You have reached your upload limit. Please wait for your pending uploads to be approved before uploading more.</p>
|
|
|
|
<p id="upload-limit">Upload Limit: <%= render "users/upload_limit", user: CurrentUser.user %></p>
|
|
<% elsif upload_media_asset.loading? %>
|
|
<p>Processing <%= external_link_to upload_media_asset.source_url %>...</p>
|
|
|
|
<% content_for(:html_header) do %>
|
|
<meta http-equiv="refresh" content="1">
|
|
<% end %>
|
|
<% elsif upload_media_asset.failed? %>
|
|
<p>Error: <%= upload_media_asset.error %>.</p>
|
|
<% else %>
|
|
<% upload = upload_media_asset.upload %>
|
|
<% media_asset = upload_media_asset.media_asset %>
|
|
|
|
<%= embed_wiki("help:upload_notice", id: "upload-guide-notice") %>
|
|
|
|
<% unless CurrentUser.is_contributor? %>
|
|
<p id="upload-limit">Upload Limit: <%= render "users/upload_limit", user: CurrentUser.user %></p>
|
|
<% end %>
|
|
|
|
<div id="client-errors" class="error-messages ui-state-error ui-corner-all" style="display:none"></div>
|
|
|
|
<div id="upload-image">
|
|
<%= render MediaAssetComponent.new(media_asset: media_asset, current_user: CurrentUser.user) %>
|
|
|
|
<div class="flex flex-none gap-2 h-6 items-center text-xs">
|
|
<% if media_asset.source_urls.present? %>
|
|
<span>
|
|
<% media_asset.source_urls.take(5).each do |url| %>
|
|
<%= external_link_to url, external_site_icon(Source::URL.site_name(url), class: "h-4"), title: url, class: "inline-block align-top" %>
|
|
<% end %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<%= link_to media_asset do %>
|
|
<%= number_to_human_size(media_asset.file_size) %> .<%= media_asset.file_ext %>,
|
|
<%= media_asset.image_width %>x<%= media_asset.image_height %>
|
|
|
|
<% if media_asset.duration.present? %>
|
|
(<%= duration_to_hhmmss(media_asset.duration) %>)
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<span>
|
|
<%= render PopupMenuComponent.new(hide_on_click: false) do |menu| %>
|
|
<% menu.item(hide_on_click: true) do %>
|
|
<%= link_to "#{media_asset.original.file_url}?download=1", download: media_asset.original.file_name do %>
|
|
<%= download_icon %> Download
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<hr class="border">
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<%= external_link_to "https://saucenao.com/search.php?url=#{CGI.escape(media_asset.original.file_url)}", target: "_blank" do %>
|
|
<%= search_icon %> SauceNAO
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<%= external_link_to "https://yandex.com/images/search?rpt=imageview&url=#{CGI.escape(media_asset.original.file_url)}", target: "_blank" do %>
|
|
<%= search_icon %> Yandex
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<%= external_link_to "https://lens.google.com/uploadbyurl?url=#{CGI.escape(media_asset.original.file_url)}", target: "_blank" do %>
|
|
<%= search_icon %> Google
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<%= external_link_to "https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=#{CGI.escape(media_asset.original.file_url)}", target: "_blank" do %>
|
|
<%= search_icon %> Bing
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% menu.item do %>
|
|
<%= link_to iqdb_queries_path(search: { media_asset_id: media_asset.id }), target: "_blank" do %>
|
|
<%= search_icon %> <%= Danbooru.config.app_name %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<%= render "uploads/related_posts", source: upload_media_asset.source_extractor %>
|
|
|
|
<% if upload_media_asset.source_extractor.present? %>
|
|
<%= render_source_data(upload_media_asset.source_extractor) %>
|
|
<% end %>
|
|
|
|
<% post = Post.new_from_upload(upload_media_asset, add_artist_tag: true, source: upload_media_asset.canonical_url, **permitted_attributes(Post).to_h.symbolize_keys) %>
|
|
<%= edit_form_for(post, html: { id: "form" }) do |f| %>
|
|
<%= hidden_field_tag :media_asset_id, media_asset.id %> <%# used by iqdb javascript %>
|
|
<%= hidden_field_tag :upload_media_asset_id, upload_media_asset.id %>
|
|
|
|
<%= f.input :source, as: :string, input_html: { value: post.source } %>
|
|
<%= f.input :rating, label: "Rating (#{link_to_wiki "?", "howto:rate"})".html_safe, collection: Post::RATINGS.invert.reverse_each.to_h, as: :radio_buttons, selected: post.rating %>
|
|
<%= f.input :parent_id, label: "Parent ID", as: :string, input_html: { value: post.parent_id } %>
|
|
|
|
<div class="input upload_artist_commentary_container">
|
|
<strong>Commentary</strong>
|
|
<a href="#" id="toggle-artist-commentary">show »</a>
|
|
|
|
<div class="artist-commentary" style="display: none;">
|
|
<%= f.input :artist_commentary_title, as: :string, label: "Original Title", input_html: { value: post&.artist_commentary&.original_title } %>
|
|
<%= f.input :artist_commentary_desc, as: :text, label: "Original Description", input_html: { value: post&.artist_commentary&.original_description } %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="input upload_commentary_translation_container" style="display: none;">
|
|
<strong>Translation</strong>
|
|
<a href="#" id="toggle-commentary-translation">show »</a>
|
|
|
|
<div class="commentary-translation" style="display: none;">
|
|
<%= f.input :translated_commentary_title, as: :string, label: "Translated Title", input_html: { value: post&.artist_commentary&.translated_title } %>
|
|
<%= f.input :translated_commentary_desc, as: :text, label: "Translated Description", input_html: { value: post&.artist_commentary&.translated_description } %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="input fixed-width-container" id="tags-container">
|
|
<div class="header">
|
|
<%= f.label :tag_string, "Tags" %>
|
|
|
|
<span data-tag-counter data-for="#post_tag_string">
|
|
<span class="tag-count"></span>
|
|
<img>
|
|
</span>
|
|
<a href="javascript:void(0)">
|
|
<%= external_link_icon(id: "open-edit-dialog", "data-shortcut": "shift+e") %>
|
|
</a>
|
|
</div>
|
|
|
|
<%= f.input :tag_string, label: false, hint: "Ctrl+Enter to submit", input_html: { "data-autocomplete": "tag-edit", "data-shortcut": "e", value: post.tag_string } %>
|
|
<%= render "related_tags/buttons" %>
|
|
</div>
|
|
|
|
<%= f.submit "Post" %>
|
|
|
|
<% if CurrentUser.is_contributor? %>
|
|
<%= f.input :is_pending, as: :boolean, label: "Upload for approval", wrapper_html: { class: "inline-block" }, input_html: { checked: post.is_pending? } %>
|
|
<% end %>
|
|
|
|
<%= render "related_tags/container", media_asset: media_asset %>
|
|
<% end %>
|
|
<% end %>
|