Merge pull request #3658 from evazion/fix-3657

Fix #3657: Add improvements to the uploads interface
This commit is contained in:
Albert Yi
2018-04-20 16:03:39 -07:00
committed by GitHub
13 changed files with 198 additions and 43 deletions

View File

@@ -0,0 +1,8 @@
<%= simple_form_for(:search, url: uploads_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :uploader_name, label: "Uploader", input_html: { value: params[:search][:uploader_name] } %>
<%= f.input :post_tags_match, label: "Post Tags", input_html: { value: params[:search][:post_tags_match] } %>
<%= f.input :source_matches, label: "Source", input_html: { value: params[:search][:source_matches] } %>
<%= f.input :status, collection: [%w[Completed completed], %w[Processing processing], %w[Pending pending], %w[Duplicate *duplicate*], %w[Error error*]], include_blank: true, selected: params[:search][:status] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -0,0 +1,9 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Listing", uploads_path %></li>
<li><%= link_to "New", new_upload_path %></li>
<li><%= link_to "Batch Upload", batch_uploads_path %></li>
<li><%= link_to "IQDB", check_iqdb_queries_path %></li>
<li><%= link_to "Help", wiki_pages_path(search: { title: "help:upload" }) %></li>
</menu>
<% end %>

View File

@@ -2,27 +2,34 @@
<div id="a-batch">
<h1>Batch Upload</h1>
<section>
<% @urls.each.with_index do |url, i| %>
<div class="upload-preview">
<p class="caption-top">
<%= link_to "Image ##{i}", new_upload_path(url: url, ref: params[:url]), target: "_blank" %>
</p>
<%= simple_form_for(:batch, url: batch_uploads_path, method: :get, defaults: { required: false }, html: { class: "one-line-form" }) do |f| %>
<%= f.input :url, label: "URL", input_html: { size: 70, value: @url, placeholder: "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65981746" } %>
<%= f.submit "Fetch" %>
<% end %>
<%= link_to new_upload_path(url: url, ref: params[:url]), target: "_blank" do %>
<% if ImageProxy.needs_proxy?(url) %>
<%= image_tag(image_proxy_uploads_path(url: url)) %>
<% elsif url.is_a?(String) %>
<%= image_tag url %>
<% else %>
Direct Link
<% if @source.present? %>
<section>
<% @source.image_urls.each.with_index do |url, i| %>
<div class="upload-preview">
<p class="caption-top">
<%= link_to "Image ##{i}", new_upload_path(url: url, ref: @url), target: "_blank" %>
</p>
<%= link_to new_upload_path(url: url, ref: @url), target: "_blank" do %>
<% if ImageProxy.needs_proxy?(url) %>
<%= image_tag(image_proxy_uploads_path(url: url)) %>
<% elsif url.is_a?(String) %>
<%= image_tag url %>
<% else %>
Direct Link
<% end %>
<% end %>
<% end %>
</div>
<% end %>
</section>
</div>
<% end %>
<p><%= link_to "Open all links in new windows", "#", :id => "link" %></p>
<p><%= link_to "Open all links in new windows", "#", :id => "link" %></p>
</section>
<% end %>
</div>
</div>
@@ -42,4 +49,4 @@
</script>
<% end %>
<%= render "posts/partials/common/secondary_links" %>
<%= render "uploads/secondary_links" %>

View File

@@ -1,23 +1,65 @@
<div id="c-uploads">
<div id="a-index">
<table width="100%" class="striped">
<%= render "uploads/search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped autofit">
<thead>
<tr>
<th></th>
<th>Upload</th>
<th>Info</th>
<th>Uploader</th>
<th>Status</th>
<th>Date</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
<% @uploads.each do |upload| %>
<tr>
<td><%= link_to upload.id, upload_path(upload) %></td>
<td><%= link_to_user upload.uploader %></td>
<td><%= upload.presenter.status(self) %></td>
<td><%= compact_time upload.created_at %></td>
<td><%= upload.tag_string %></td>
<td>
<%= PostPresenter.preview(upload.post, tags: "user:#{upload.uploader_name}", show_deleted: true) %>
</td>
<td class="col-expand upload-info">
<span class="info">
<strong>Upload</strong>
<%= link_to "##{upload.id}", upload %>
</span>
<span class="info">
<strong>Rating</strong>
<%= upload.rating %>
</span>
<% if upload.post.present? %>
<span class="info">
<strong>Size</strong>
<%= link_to "#{upload.post.file_size.to_s(:human_size, precision: 4)} #{upload.post.file_ext}", upload.post.file_url %>
<% if upload.post.has_dimensions? %>
(<%= upload.post.image_width %>x<%= upload.post.image_height %>)
<% end %>
</span>
<% end %>
<br>
<span class="info">
<strong>Source</strong>
<%= link_to_if (upload.source =~ %r!\Ahttps?://!i), (upload.source.presence || content_tag(:em, "none")), upload.source %>
<%= link_to "»", uploads_path(search: params[:search].merge(source_matches: upload.source)) %>
</span>
<br>
<span class="info">
<strong>Tags</strong>
<%= TagSetPresenter.new(upload.tag_string.split).inline_tag_list(self) %>
</span>
</td>
<td>
<%= link_to_user upload.uploader %>
<%= link_to "»", uploads_path(search: params[:search].merge(uploader_name: upload.uploader_name)) %>
<br><%= time_ago_in_words_tagged upload.created_at %>
</td>
<td class="col-normal">
<%= link_to upload.presenter.status(self), uploads_path(search: params[:search].merge(status: upload.status)) %>
</td>
</tr>
<% end %>
</tbody>
@@ -27,7 +69,7 @@
</div>
</div>
<%= render "posts/partials/common/secondary_links" %>
<%= render "uploads/secondary_links" %>
<% content_for(:page_title) do %>
Uploads - <%= Danbooru.config.app_name %>

View File

@@ -143,4 +143,4 @@
Upload - <%= Danbooru.config.app_name %>
<% end %>
<%= render "posts/partials/common/secondary_links" %>
<%= render "uploads/secondary_links" %>

View File

@@ -36,7 +36,7 @@
</div>
</div>
<%= render "posts/partials/common/secondary_links" %>
<%= render "uploads/secondary_links" %>
<% content_for(:page_title) do %>
Upload - <%= Danbooru.config.app_name %>