forked from e621ng/e621ng
parent
fb1bfd7962
commit
f995714992
@ -9,15 +9,15 @@ class PostsDecorator < ApplicationDecorator
|
||||
|
||||
def preview_class(options)
|
||||
post = object
|
||||
klass = ["post-preview"]
|
||||
klass << "post-status-pending" if post.is_pending?
|
||||
klass << "post-status-flagged" if post.is_flagged?
|
||||
klass << "post-status-deleted" if post.is_deleted?
|
||||
klass << "post-status-has-parent" if post.parent_id
|
||||
klass << "post-status-has-children" if post.has_visible_children?
|
||||
klass << "post-rating-safe" if post.rating == "s"
|
||||
klass << "post-rating-questionable" if post.rating == "q"
|
||||
klass << "post-rating-explicit" if post.rating == "e"
|
||||
klass = ["thumbnail"]
|
||||
klass << "pending" if post.is_pending?
|
||||
klass << "flagged" if post.is_flagged?
|
||||
klass << "deleted" if post.is_deleted?
|
||||
klass << "has-parent" if post.parent_id
|
||||
klass << "has-children" if post.has_visible_children?
|
||||
klass << "rating-safe" if post.rating == "s"
|
||||
klass << "rating-questionable" if post.rating == "q"
|
||||
klass << "rating-explicit" if post.rating == "e"
|
||||
klass << "blacklistable" unless options[:no_blacklist]
|
||||
klass
|
||||
end
|
||||
@ -42,21 +42,21 @@ class PostsDecorator < ApplicationDecorator
|
||||
score > 0 ? 'score-positive' : 'score-negative'
|
||||
end
|
||||
|
||||
def stats_section(t)
|
||||
def stats_section(template)
|
||||
post = object
|
||||
status_flags = []
|
||||
status_flags << 'P' if post.parent_id
|
||||
status_flags << 'C' if post.has_children?
|
||||
status_flags << 'U' if post.is_pending?
|
||||
status_flags << 'F' if post.is_flagged?
|
||||
status_flags << "P" if post.parent_id
|
||||
status_flags << "C" if post.has_children?
|
||||
status_flags << "U" if post.is_pending?
|
||||
status_flags << "F" if post.is_flagged?
|
||||
|
||||
post_score_icon = "#{'↑' if post.score > 0}#{'↓' if post.score < 0}#{'↕' if post.score == 0}"
|
||||
score = t.tag.span("#{post_score_icon}#{post.score}", class: "post-score-score #{score_class(post.score)}")
|
||||
favs = t.tag.span("♥#{post.fav_count}", class: "post-score-faves")
|
||||
comments = t.tag.span "C#{post.visible_comment_count(CurrentUser)}", class: 'post-score-comments'
|
||||
rating = t.tag.span(post.rating.upcase, class: "post-score-rating")
|
||||
status = t.tag.span(status_flags.join(''), class: 'post-score-extras')
|
||||
t.tag.div score + favs + comments + rating + status, class: 'post-score', id: "post-score-#{post.id}"
|
||||
score = template.tag.span("#{post_score_icon}#{post.score}", class: "score #{score_class(post.score)}")
|
||||
favs = template.tag.span("♥#{post.fav_count}", class: "favorites")
|
||||
comments = template.tag.span "C#{post.visible_comment_count(CurrentUser)}", class: "comments"
|
||||
rating = template.tag.span(post.rating.upcase, class: "rating")
|
||||
# status = template.tag.span(status_flags.join, class: "extras")
|
||||
template.tag.div score + favs + comments + rating, class: "desc"
|
||||
end
|
||||
|
||||
def preview_html(t, options = {})
|
||||
@ -115,16 +115,10 @@ class PostsDecorator < ApplicationDecorator
|
||||
post.preview_file_url
|
||||
end
|
||||
|
||||
alt_text = post.tag_string
|
||||
alt_text = "post ##{post.id}"
|
||||
|
||||
has_cropped = post.has_cropped?
|
||||
|
||||
pool = options[:pool]
|
||||
|
||||
similarity = options[:similarity]&.round
|
||||
|
||||
size = options[:size] ? post.file_size : nil
|
||||
|
||||
img_contents = t.link_to t.polymorphic_path(link_target, link_params) do
|
||||
t.tag.picture do
|
||||
t.concat t.tag.source media: "(max-width: 800px)", srcset: cropped_url
|
||||
@ -132,13 +126,7 @@ class PostsDecorator < ApplicationDecorator
|
||||
t.concat t.tag.img class: "has-cropped-#{has_cropped}", src: preview_url, title: tooltip, alt: alt_text
|
||||
end
|
||||
end
|
||||
desc_contents = if options[:stats] || pool || similarity || size
|
||||
t.tag.div class: "desc" do
|
||||
stats_section(t) if options[:stats]
|
||||
end
|
||||
else
|
||||
"".html_safe
|
||||
end
|
||||
desc_contents = options[:stats] ? stats_section(t) : "".html_safe
|
||||
t.tag.article(**article_attrs) do
|
||||
img_contents + desc_contents
|
||||
end
|
||||
|
@ -117,7 +117,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def body_attributes(user = CurrentUser.user)
|
||||
attributes = [:id, :name, :level, :level_string, :can_approve_posts?, :can_upload_free?, :per_page]
|
||||
attributes = %i[id name level level_string can_approve_posts? can_upload_free? per_page]
|
||||
attributes += User::Roles.map { |role| :"is_#{role}?" }
|
||||
|
||||
controller_param = params[:controller].parameterize.dasherize
|
||||
@ -125,12 +125,13 @@ module ApplicationHelper
|
||||
|
||||
{
|
||||
lang: "en",
|
||||
class: "c-#{controller_param} a-#{action_param} #{"resp" unless disable_mobile_mode?}",
|
||||
class: "c-#{controller_param} a-#{action_param} #{'resp' unless disable_mobile_mode?}",
|
||||
data: {
|
||||
controller: controller_param,
|
||||
action: action_param,
|
||||
**data_attributes_for(user, "user", attributes)
|
||||
}
|
||||
**data_attributes_for(user, "user", attributes),
|
||||
disable_cropped_thumbnails: Danbooru.config.enable_image_cropping? && CurrentUser.user.disable_cropped_thumbnails?,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -87,18 +87,18 @@ module PostsHelper
|
||||
|
||||
def post_stats_section(post)
|
||||
status_flags = []
|
||||
status_flags << 'P' if post.parent_id
|
||||
status_flags << 'C' if post.has_active_children?
|
||||
status_flags << 'U' if post.is_pending?
|
||||
status_flags << 'F' if post.is_flagged?
|
||||
status_flags << "P" if post.parent_id
|
||||
status_flags << "C" if post.has_active_children?
|
||||
status_flags << "U" if post.is_pending?
|
||||
status_flags << "F" if post.is_flagged?
|
||||
|
||||
post_score_icon = "#{'↑' if post.score > 0}#{'↓' if post.score < 0}#{'↕' if post.score == 0}"
|
||||
score = tag.span("#{post_score_icon}#{post.score}", class: "post-score-score #{score_class(post.score)}")
|
||||
favs = tag.span("♥#{post.fav_count}", class: "post-score-faves")
|
||||
comments = tag.span "C#{post.visible_comment_count(CurrentUser)}", class: 'post-score-comments'
|
||||
rating = tag.span(post.rating.upcase, class: "post-score-rating")
|
||||
status = tag.span(status_flags.join(''), class: 'post-score-extras')
|
||||
tag.div score + favs + comments + rating + status, class: 'post-score', id: "post-score-#{post.id}"
|
||||
score = tag.span("#{post_score_icon}#{post.score}", class: "score #{score_class(post.score)}")
|
||||
favs = tag.span("♥#{post.fav_count}", class: "favorites")
|
||||
comments = tag.span "C#{post.visible_comment_count(CurrentUser)}", class: "comments"
|
||||
rating = tag.span(post.rating.upcase, class: "rating")
|
||||
# status = tag.span(status_flags.join, class: "extras")
|
||||
tag.div score + favs + comments + rating, class: "desc"
|
||||
end
|
||||
|
||||
def user_record_meta(user)
|
||||
|
@ -55,7 +55,7 @@ PostModeMenu.initialize_selector = function () {
|
||||
};
|
||||
|
||||
PostModeMenu.initialize_preview_link = function () {
|
||||
$(".post-preview").on("click.danbooru", PostModeMenu.click);
|
||||
$(".thumbnail").on("click.danbooru", PostModeMenu.click);
|
||||
};
|
||||
|
||||
PostModeMenu.initialize_edit_form = function () {
|
||||
@ -107,7 +107,7 @@ PostModeMenu.initialize_tag_script_field = function () {
|
||||
|
||||
PostModeMenu.tag_script_apply_all = function (event) {
|
||||
event.preventDefault();
|
||||
$("article.post-preview").trigger("click");
|
||||
$("article.thumbnail").trigger("click");
|
||||
};
|
||||
|
||||
PostModeMenu.update_sets_menu = function () {
|
||||
|
@ -33,6 +33,7 @@
|
||||
@import "common/spoiler.scss";
|
||||
@import "common/tables.scss";
|
||||
@import "common/tags.scss";
|
||||
@import "common/thumbnails.scss";
|
||||
@import "common/user_styles.scss";
|
||||
@import "common/voting.scss";
|
||||
|
||||
|
@ -25,18 +25,22 @@ $base_font_family: Verdana, sans-serif;
|
||||
$box-shadow-size: 2px 2px 5px;
|
||||
|
||||
@mixin preview-type-badge($text) {
|
||||
background-color: themed("color-section");
|
||||
border: 1px solid themed("color-text-white");
|
||||
color: themed("color-text");
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
left: 0;
|
||||
top: 0.5rem;
|
||||
text-align: center;
|
||||
border-radius: $border-radius-full;
|
||||
padding: 3px 5px;
|
||||
padding: 2px 4px;
|
||||
|
||||
background-color: themed("color-section");
|
||||
color: themed("color-text");
|
||||
font-size: 60%;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
|
||||
border-radius: 0 $border-radius-half $border-radius-half 0;
|
||||
border: 1px solid themed("color-text-muted");
|
||||
border-left: 0;
|
||||
|
||||
content: $text;
|
||||
}
|
||||
|
||||
|
@ -191,14 +191,13 @@
|
||||
#c-posts #a-index,
|
||||
#c-popular,
|
||||
#c-favorites {
|
||||
.post-preview.blacklisted {
|
||||
.thumbnail.blacklisted {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
#image-container.blacklisted,
|
||||
.post-thumbnail.blacklisted,
|
||||
.post-preview.blacklisted {
|
||||
.post-thumbnail.blacklisted {
|
||||
img,
|
||||
video {
|
||||
height: 0px !important;
|
||||
@ -216,3 +215,14 @@
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
article.thumbnail.blacklisted {
|
||||
width: 100%;
|
||||
& > a {
|
||||
height: 100%;
|
||||
background-image: url("blacklisted-preview.png");
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
img { display: none; }
|
||||
}
|
||||
|
189
app/javascript/src/styles/common/thumbnails.scss
Normal file
189
app/javascript/src/styles/common/thumbnails.scss
Normal file
@ -0,0 +1,189 @@
|
||||
// Thumbnail dimensions
|
||||
$thumb-image-size: 150px;
|
||||
$thumb-border-width: 2px;
|
||||
$thumb-mobile-cols: 3;
|
||||
$thumb-gap: 8px;
|
||||
|
||||
|
||||
// Switch to desktop view at this width
|
||||
// Last value is the #page padding
|
||||
$thumb-desktop-breakpoint: ($thumb-image-size * $thumb-mobile-cols) + (2 * $thumb-gap) + 8px;
|
||||
|
||||
|
||||
// Posts container
|
||||
// May or may not exist on some pages
|
||||
section.posts-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat($thumb-mobile-cols, 1fr);
|
||||
gap: 0.5rem;
|
||||
|
||||
@include window-larger-than($thumb-desktop-breakpoint) {
|
||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Thumbnail proper
|
||||
article.thumbnail {
|
||||
display: inline-flex;
|
||||
flex-flow: column;
|
||||
max-width: $thumb-image-size;
|
||||
justify-self: center; // Center the thumbnail in the grid cell
|
||||
position: relative; // Position badges correctly
|
||||
overflow: hidden;
|
||||
|
||||
@include window-larger-than($thumb-desktop-breakpoint) {
|
||||
width: min-content; // Force .desc to be the same width as the image
|
||||
}
|
||||
|
||||
// Badges
|
||||
&[data-tags~=animated] > a:before { @include preview-type-badge("ANIM"); }
|
||||
&[data-file-ext=webm] > a:before { @include preview-type-badge("WEBM"); }
|
||||
|
||||
a { text-align: center; } // Fixes an issue with blacklisted pool thumbnails
|
||||
|
||||
img {
|
||||
box-sizing: border-box; // Prevent the border from resizing the entire element
|
||||
max-width: $thumb-image-size;
|
||||
max-height: $thumb-image-size;
|
||||
|
||||
border-radius: $border-radius-half $border-radius-half 0 0;
|
||||
pointer-events: none; // Should probably just fix the click events, huh
|
||||
|
||||
// Mobile view
|
||||
width: 100%;
|
||||
@include window-larger-than($thumb-desktop-breakpoint) {
|
||||
width: unset;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
display: flex;
|
||||
gap: 0.25em;
|
||||
justify-content: center;
|
||||
|
||||
background-color: themed("color-section-lighten-5");
|
||||
border-radius: 0 0 $border-radius-half $border-radius-half;
|
||||
|
||||
.rating { font-weight: 700; }
|
||||
& > a { text-align: center; } // Pool names
|
||||
}
|
||||
|
||||
// Color the rating letters
|
||||
@each $name, $color in ("e": "red", "q": "yellow", "s": "green") {
|
||||
&[data-rating=#{$name}] .desc .rating { color: palette("text-#{$color}"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fix for when posts have no cropped versions
|
||||
// Should be made irrelevant later, but this will do for now
|
||||
@include window-smaller-than(800px) {
|
||||
body[data-disable-cropped-thumbnails="false"] article.thumbnail {
|
||||
width: 100%;
|
||||
a { height: 100%; }
|
||||
img {
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
@include window-larger-than($thumb-desktop-breakpoint) {
|
||||
&.has-cropped-false { width: 150px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// I have absolutely no idea what this
|
||||
// does or when it might be triggered.
|
||||
article.thumbnail.current-post {
|
||||
background-color: $post-preview-highlight-background;
|
||||
}
|
||||
|
||||
|
||||
// Nightmarish mess ahead
|
||||
// Set thumbnail borders based on status
|
||||
article.thumbnail {
|
||||
&.has-children img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.has-parent img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.has-children.has-parent img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-has-parent-color $preview-has-parent-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
|
||||
&.deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-deleted-color;
|
||||
}
|
||||
|
||||
&.has-children.deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-deleted-color $preview-deleted-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.has-parent.deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-deleted-color $preview-deleted-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.has-children.has-parent.deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-deleted-color $preview-deleted-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
|
||||
&.pending img,
|
||||
&.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-pending-color;
|
||||
}
|
||||
|
||||
&.has-children.pending img,
|
||||
&.has-children.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-pending-color $preview-pending-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.has-parent.pending img,
|
||||
&.has-parent.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-pending-color $preview-pending-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.has-children.has-parent.pending img,
|
||||
&.has-children.has-parent.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-pending-color $preview-pending-color $preview-has-parent-color;
|
||||
}
|
||||
}
|
||||
|
||||
// Flagged posts have red borders for approvers.
|
||||
body[data-user-can-approve-posts="true"] article.thumbnail {
|
||||
&.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-flagged-color;
|
||||
}
|
||||
|
||||
&.has-children.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-flagged-color $preview-flagged-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.has-parent.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-flagged-color $preview-flagged-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.has-children.has-parent.flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-flagged-color $preview-flagged-color $preview-has-parent-color;
|
||||
}
|
||||
}
|
@ -197,53 +197,6 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#posts #posts-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
article.post-preview {
|
||||
float: none;
|
||||
margin: 0 0 10px 0;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: 31vw;
|
||||
|
||||
a {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
img {
|
||||
max-height: 150px;
|
||||
max-width: 31vw;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-disable-cropped-false {
|
||||
article.post-preview {
|
||||
width: 31vw;
|
||||
|
||||
img {
|
||||
height: auto;
|
||||
max-height: none;
|
||||
max-width: none;
|
||||
width: 31vw;
|
||||
|
||||
&.has-cropped-false {
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div#options {
|
||||
margin-top: 10px;
|
||||
font-size: 24pt;
|
||||
|
@ -1,6 +1,6 @@
|
||||
div#c-iqdb-queries {
|
||||
div#a-show {
|
||||
article.post-preview {
|
||||
article.thumbnail {
|
||||
width: 180px;
|
||||
border: $iqdb-post-border solid 1px;
|
||||
|
||||
|
@ -25,10 +25,6 @@ $modes: (
|
||||
}
|
||||
}
|
||||
|
||||
#page:not([data-mode-menu="view"]) article.post-preview img {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#tag-script-ui {
|
||||
display: flex;
|
||||
margin-top: 0.5em;
|
||||
|
@ -3,163 +3,15 @@
|
||||
width: 15em; // Match width to that of the
|
||||
}
|
||||
|
||||
article.post-preview {
|
||||
box-sizing: border-box;
|
||||
height: auto;
|
||||
width: fit-content;
|
||||
margin: 0 10px 10px 0;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: text-top;
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.desc {
|
||||
background-color: themed("color-section-lighten-5");
|
||||
font-size: 80%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
&.filter-matches .desc {
|
||||
background-color: var(--palette-background-red);
|
||||
}
|
||||
|
||||
.post-score>span {
|
||||
font-size: 0.8rem;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
&.post-rating-explicit .post-score-rating {
|
||||
color: palette("text-red");
|
||||
}
|
||||
|
||||
&.post-rating-safe .post-score-rating {
|
||||
color: palette("text-green");
|
||||
}
|
||||
|
||||
&.post-rating-questionable .post-score-rating {
|
||||
color: palette("text-yellow");
|
||||
}
|
||||
|
||||
img {
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
max-height: 10rem; // Roughly 160px with 16pt font size
|
||||
max-width: 10rem;
|
||||
border-radius: $border-radius-half $border-radius-half 0 0;
|
||||
}
|
||||
|
||||
&[data-tags~=animated] > a:before {
|
||||
@include preview-type-badge('ANIM');
|
||||
}
|
||||
|
||||
&[data-file-ext=webm] > a:before {
|
||||
@include preview-type-badge('WEBM');
|
||||
}
|
||||
}
|
||||
|
||||
#edit-dialog textarea {
|
||||
margin-bottom: 0.25em;
|
||||
}
|
||||
|
||||
.post-preview {
|
||||
&.post-status-has-children img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.post-status-has-parent img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-has-parent img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-has-parent-color $preview-has-parent-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
|
||||
&.post-status-deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-deleted-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-deleted-color $preview-deleted-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.post-status-has-parent.post-status-deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-deleted-color $preview-deleted-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-has-parent.post-status-deleted img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-deleted-color $preview-deleted-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
|
||||
&.post-status-pending img,
|
||||
&.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-pending-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-pending img,
|
||||
&.post-status-has-children.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-pending-color $preview-pending-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.post-status-has-parent.post-status-pending img,
|
||||
&.post-status-has-parent.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-pending-color $preview-pending-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-has-parent.post-status-pending img,
|
||||
&.post-status-has-children.post-status-has-parent.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-pending-color $preview-pending-color $preview-has-parent-color;
|
||||
}
|
||||
}
|
||||
|
||||
/* Flagged posts have red borders for approvers. */
|
||||
body[data-user-can-approve-posts="true"] .post-preview {
|
||||
&.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-flagged-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-flagged-color $preview-flagged-color $preview-has-children-color;
|
||||
}
|
||||
|
||||
&.post-status-has-parent.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-parent-color $preview-flagged-color $preview-flagged-color $preview-has-parent-color;
|
||||
}
|
||||
|
||||
&.post-status-has-children.post-status-has-parent.post-status-flagged img {
|
||||
border: 2px solid transparent;
|
||||
border-color: $preview-has-children-color $preview-flagged-color $preview-flagged-color $preview-has-parent-color;
|
||||
}
|
||||
}
|
||||
|
||||
.post-preview.current-post {
|
||||
background-color: $post-preview-highlight-background;
|
||||
}
|
||||
|
||||
#has-parent-relationship-preview, #has-children-relationship-preview {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
|
||||
article.post-preview {
|
||||
article.thumbnail {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 5px 5px 10px;
|
||||
|
@ -175,12 +175,6 @@ div#c-users {
|
||||
border-top-left-radius: 0;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
article.post-preview {
|
||||
flex: 0 0 154px;
|
||||
margin: 0;
|
||||
img { max-width: unset !important; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ class PostPresenter < Presenter
|
||||
locals = {}
|
||||
|
||||
locals[:article_attrs] = {
|
||||
"id" => "post_#{post.id}",
|
||||
"class" => preview_class(post, **options).join(" ")
|
||||
"id" => "post_#{post.id}",
|
||||
"class" => preview_class(post, **options).join(" "),
|
||||
}.merge(data_attributes(post))
|
||||
|
||||
locals[:link_target] = options[:link_target] || post
|
||||
@ -54,7 +54,7 @@ class PostPresenter < Presenter
|
||||
post.preview_file_url
|
||||
end
|
||||
|
||||
locals[:alt_text] = post.tag_string
|
||||
locals[:alt_text] = "post ##{post.id}"
|
||||
|
||||
locals[:has_cropped] = post.has_cropped?
|
||||
|
||||
@ -91,15 +91,15 @@ class PostPresenter < Presenter
|
||||
end
|
||||
|
||||
def self.preview_class(post, pool: nil, size: nil, similarity: nil, **options)
|
||||
klass = ["post-preview"]
|
||||
klass << "post-status-pending" if post.is_pending?
|
||||
klass << "post-status-flagged" if post.is_flagged?
|
||||
klass << "post-status-deleted" if post.is_deleted?
|
||||
klass << "post-status-has-parent" if post.parent_id
|
||||
klass << "post-status-has-children" if post.has_visible_children?
|
||||
klass << "post-rating-safe" if post.rating == "s"
|
||||
klass << "post-rating-questionable" if post.rating == "q"
|
||||
klass << "post-rating-explicit" if post.rating == "e"
|
||||
klass = ["thumbnail"]
|
||||
klass << "pending" if post.is_pending?
|
||||
klass << "flagged" if post.is_flagged?
|
||||
klass << "deleted" if post.is_deleted?
|
||||
klass << "has-parent" if post.parent_id
|
||||
klass << "has-children" if post.has_visible_children?
|
||||
klass << "rating-safe" if post.rating == "s"
|
||||
klass << "rating-questionable" if post.rating == "q"
|
||||
klass << "rating-explicit" if post.rating == "e"
|
||||
klass << "blacklistable" unless options[:no_blacklist]
|
||||
klass
|
||||
end
|
||||
|
@ -54,7 +54,8 @@ class UserPresenter
|
||||
end
|
||||
|
||||
def uploads
|
||||
Post.tag_match("user:#{user.name}").limit(8)
|
||||
posts = Post.tag_match("user:#{user.name}").limit(8)
|
||||
PostsDecorator.decorate_collection(posts)
|
||||
end
|
||||
|
||||
def has_uploads?
|
||||
@ -63,7 +64,8 @@ class UserPresenter
|
||||
|
||||
def favorites
|
||||
ids = Favorite.where(user_id: user.id).order(created_at: :desc).limit(50).pluck(:post_id)[0..7]
|
||||
Post.where(id: ids).sort_by { |post| ids.index(post.id) }
|
||||
posts = Post.where(id: ids).sort_by { |post| ids.index(post.id) }
|
||||
PostsDecorator.decorate_collection(posts)
|
||||
end
|
||||
|
||||
def has_favorites?
|
||||
|
@ -18,14 +18,12 @@
|
||||
</aside>
|
||||
|
||||
<section id="content">
|
||||
<h1>Favorites</h1>
|
||||
|
||||
<%= render "posts/partials/index/edit" %>
|
||||
|
||||
<div id="posts" class="user-disable-cropped-<%= Danbooru.config.enable_image_cropping? && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<div id="posts-container">
|
||||
<section class="posts-container">
|
||||
<%= @favorite_set.presenter.post_previews_html(self) %>
|
||||
</div>
|
||||
</section>
|
||||
<%= numbered_paginator(@favorite_set.posts) %>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -63,13 +63,13 @@
|
||||
</script>
|
||||
|
||||
<style id="blacklisted-hider">
|
||||
.post-preview, #image-container, #c-comments .post, .post-thumbnail {
|
||||
.thumbnail, #image-container, #c-comments .post, .post-thumbnail {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
</style>
|
||||
<noscript>
|
||||
<style>
|
||||
.post-preview, #image-container, #c-comments .post, .post-thumbnail {
|
||||
.thumbnail, #image-container, #c-comments .post, .post-thumbnail {
|
||||
visibility: visible !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<h2>Pools</h2>
|
||||
|
||||
<section>
|
||||
<section class="posts-container">
|
||||
<% if @pools.none? %>
|
||||
<%= render "posts/blank" %>
|
||||
<% else %>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<div id="posts" class="user-disable-cropped-<%= Danbooru.config.enable_image_cropping? && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<div id="posts-container">
|
||||
<section class="posts-container">
|
||||
<% if @posts.none? %>
|
||||
<%= render "posts/blank" %>
|
||||
<% else %>
|
||||
|
@ -7,9 +7,9 @@
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<div id="posts" class="user-disable-cropped-<%= Danbooru.config.enable_image_cropping? && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<div id="posts-container">
|
||||
<section class="posts-container">
|
||||
<%= @post_set.presenter.post_previews_html(self, show_cropped: true) %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div id="posts" class="user-disable-cropped-<%= Danbooru.config.enable_image_cropping? && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<div id="posts-container">
|
||||
<section class="posts-container">
|
||||
<% if @posts.empty? %>
|
||||
<%= render "posts/blank" %>
|
||||
<% else %>
|
||||
@ -7,7 +7,7 @@
|
||||
<%= post.preview_html(self, {tags: @post_set.public_tag_string, show_cropped: true, stats: CurrentUser.show_post_statistics?}) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<% if post_set.hidden_posts.present? %>
|
||||
<div class="info hidden-posts-notice">
|
||||
|
@ -7,23 +7,21 @@
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if stats -%>
|
||||
<div class="desc">
|
||||
<%= post_stats_section(post) %>
|
||||
</div>
|
||||
<%= post_stats_section(post) %>
|
||||
<% end -%>
|
||||
<% if pool -%>
|
||||
<p class="desc">
|
||||
<div class="desc">
|
||||
<%= link_to pool.pretty_name.truncate(80), pool %>
|
||||
</p>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% if similarity -%>
|
||||
<p class="desc">
|
||||
<div class="desc">
|
||||
Similarity: <%= similarity %>
|
||||
</p>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% if size -%>
|
||||
<p class="desc">
|
||||
<div class="desc">
|
||||
<%= number_to_human_size(size) %> <%= file_ext.upcase %> (<%= width %>x<%= height %>)
|
||||
</p>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
<div class="profile-sample-posts">
|
||||
<% presenter.uploads.each do |post| %>
|
||||
<%= PostPresenter.preview(post, :tags => "user:#{user.name}") %>
|
||||
<%= post.preview_html(self, { tags: "user:#{user.name}", show_cropped: true, stats: CurrentUser.show_post_statistics? }) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
<div class="profile-sample-posts">
|
||||
<% presenter.favorites.each do |post| %>
|
||||
<%= PostPresenter.preview(post, :tags => "fav:#{user.name}") %>
|
||||
<%= post.preview_html(self, { tags: "fav:#{user.name}", show_cropped: true, stats: CurrentUser.show_post_statistics? }) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user