uploads: revamp /uploads listing UI (#3657).
* Add thumbnails. * Colorize tags. * Rearrange columns. * Add rating/source/size/dimensions info. * Add "»" search drilldown links.
This commit is contained in:
@@ -54,6 +54,10 @@ table.autofit {
|
|||||||
white-space: normal;
|
white-space: normal;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.col-normal {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table.search {
|
table.search {
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ div#c-uploads {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#a-index {
|
||||||
|
.info {
|
||||||
|
margin-right: 1.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
div.upload-preview {
|
div.upload-preview {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ class UploadsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Upload.search(search_params)
|
@uploads = Upload.search(search_params).includes(:post, :uploader).paginate(params[:page], :limit => params[:limit])
|
||||||
@uploads = @search.paginate(params[:page], :limit => params[:limit])
|
|
||||||
respond_with(@uploads) do |format|
|
respond_with(@uploads) do |format|
|
||||||
format.xml do
|
format.xml do
|
||||||
render :xml => @uploads.to_xml(:root => "uploads")
|
render :xml => @uploads.to_xml(:root => "uploads")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class PostPresenter < Presenter
|
|||||||
|
|
||||||
def self.preview(post, options = {})
|
def self.preview(post, options = {})
|
||||||
if post.nil?
|
if post.nil?
|
||||||
return "Expunged"
|
return "<em>none</em>".html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
if !options[:show_deleted] && post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw]
|
if !options[:show_deleted] && post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw]
|
||||||
|
|||||||
@@ -1,25 +1,65 @@
|
|||||||
<div id="c-uploads">
|
<div id="c-uploads">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<%= render "uploads/search" %>
|
<%= render "uploads/search" %>
|
||||||
|
<%= render "posts/partials/common/inline_blacklist" %>
|
||||||
|
|
||||||
<table width="100%" class="striped">
|
<table width="100%" class="striped autofit">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th>Upload</th>
|
||||||
|
<th>Info</th>
|
||||||
<th>Uploader</th>
|
<th>Uploader</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Date</th>
|
|
||||||
<th>Tags</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @uploads.each do |upload| %>
|
<% @uploads.each do |upload| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to upload.id, upload_path(upload) %></td>
|
<td>
|
||||||
<td><%= link_to_user upload.uploader %></td>
|
<%= PostPresenter.preview(upload.post, tags: "user:#{upload.uploader_name}", show_deleted: true) %>
|
||||||
<td><%= upload.presenter.status(self) %></td>
|
</td>
|
||||||
<td><%= compact_time upload.created_at %></td>
|
<td class="col-expand upload-info">
|
||||||
<td><%= upload.tag_string %></td>
|
<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>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user