modqueue: move score highlighting from js to presenter.
The 'post-has-children' class was dropped because it was unused
('post-status-has-children' is already added elsewhere).
This commit is contained in:
@@ -14,22 +14,6 @@ ModQueue.increment_processed = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModQueue.initialize_hilights = function() {
|
|
||||||
$.each($("div.post"), function(i, v) {
|
|
||||||
var $post = $(v);
|
|
||||||
var score = parseInt($post.data("score"));
|
|
||||||
if (score >= 3) {
|
|
||||||
$post.addClass("post-pos-score");
|
|
||||||
}
|
|
||||||
if (score <= -3) {
|
|
||||||
$post.addClass("post-neg-score");
|
|
||||||
}
|
|
||||||
if ($post.data("has-children")) {
|
|
||||||
$post.addClass("post-has-children");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ModQueue.detailed_rejection_dialog = function() {
|
ModQueue.detailed_rejection_dialog = function() {
|
||||||
$("#post_disapproval_post_id").val($(this).data("post-id"));
|
$("#post_disapproval_post_id").val($(this).data("post-id"));
|
||||||
$("#detailed-rejection-dialog").find("form")[0].reset();
|
$("#detailed-rejection-dialog").find("form")[0].reset();
|
||||||
@@ -40,11 +24,6 @@ ModQueue.detailed_rejection_dialog = function() {
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$(window).on("danbooru:modqueue_increment_processed", ModQueue.increment_processed);
|
$(window).on("danbooru:modqueue_increment_processed", ModQueue.increment_processed);
|
||||||
|
|
||||||
if ($("#c-moderator-post-queues").length) {
|
|
||||||
ModQueue.initialize_hilights();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).on("click.danbooru", ".quick-mod .detailed-rejection-link", ModQueue.detailed_rejection_dialog);
|
$(document).on("click.danbooru", ".quick-mod .detailed-rejection-link", ModQueue.detailed_rejection_dialog);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -81,15 +81,17 @@ class PostPresenter < Presenter
|
|||||||
ApplicationController.render(partial: "posts/partials/index/preview", locals: locals)
|
ApplicationController.render(partial: "posts/partials/index/preview", locals: locals)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.preview_class(post, options = {})
|
def self.preview_class(post, highlight_score: nil, pooled: nil, size: nil, similarity: nil, **options)
|
||||||
klass = ["post-preview"]
|
klass = ["post-preview"]
|
||||||
# klass << " large-cropped" if post.has_cropped? && options[:show_cropped]
|
# klass << " large-cropped" if post.has_cropped? && options[:show_cropped]
|
||||||
klass << "captioned" if options.values_at(:pooled, :size, :similarity).any?(&:present?)
|
klass << "captioned" if pooled || size || similarity
|
||||||
klass << "post-status-pending" if post.is_pending?
|
klass << "post-status-pending" if post.is_pending?
|
||||||
klass << "post-status-flagged" if post.is_flagged?
|
klass << "post-status-flagged" if post.is_flagged?
|
||||||
klass << "post-status-deleted" if post.is_deleted?
|
klass << "post-status-deleted" if post.is_deleted?
|
||||||
klass << "post-status-has-parent" if post.parent_id
|
klass << "post-status-has-parent" if post.parent_id
|
||||||
klass << "post-status-has-children" if post.has_visible_children?
|
klass << "post-status-has-children" if post.has_visible_children?
|
||||||
|
klass << "post-pos-score" if highlight_score && post.score >= 3
|
||||||
|
klass << "post-neg-score" if highlight_score && post.score <= -3
|
||||||
klass
|
klass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= content_tag(:div, { id: "post-#{post.id}", class: ["post", "mod-queue-preview", *PostPresenter.preview_class(post)].join(" ") }.merge(PostPresenter.data_attributes(post))) do %>
|
<%= content_tag(:div, { id: "post-#{post.id}", class: ["post", "mod-queue-preview", *PostPresenter.preview_class(post, highlight_score: true)].join(" ") }.merge(PostPresenter.data_attributes(post))) do %>
|
||||||
<aside>
|
<aside>
|
||||||
<%= link_to(image_tag(post.preview_file_url), post_path(post), :target => "_blank") %>
|
<%= link_to(image_tag(post.preview_file_url), post_path(post), :target => "_blank") %>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
Reference in New Issue
Block a user