fixes #874
This commit is contained in:
@@ -1 +1 @@
|
||||
$(function() {});
|
||||
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.tags_include = function(name) {
|
||||
var current = $("#upload_tag_string,#post_tag_string").val().match(/\S+/g) || [];
|
||||
if ($.inArray(name, current) > -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.common_bind = function(button_name, category) {
|
||||
$(button_name).click(function(e) {
|
||||
@@ -178,6 +187,9 @@
|
||||
|
||||
$field[0].selectionStart = $field.val().length;
|
||||
Danbooru.RelatedTag.build_all();
|
||||
if (Danbooru.RelatedTag.recent_artist && $("#artist-tags-container").css("display") === "block") {
|
||||
Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
@@ -190,6 +202,7 @@
|
||||
}
|
||||
|
||||
Danbooru.RelatedTag.process_artist = function(data) {
|
||||
Danbooru.RelatedTag.recent_artist = data;
|
||||
$("#artist-tags-container").show();
|
||||
var $dest = $("#artist-tags");
|
||||
$dest.empty();
|
||||
@@ -206,12 +219,16 @@
|
||||
if (!json.other_names) {
|
||||
json.other_names = "";
|
||||
}
|
||||
var $div = $("<div/>").addClass("artist");
|
||||
var $div = $("<div/>").addClass("tag-column").addClass("artist");
|
||||
var $ul = $("<ul/>");
|
||||
var $link = null;
|
||||
var $link = $("<a/>").attr("href", "/artists/" + json.id).html(json.name).click(Danbooru.RelatedTag.toggle_tag);
|
||||
if (Danbooru.RelatedTag.tags_include(json.name)) {
|
||||
$link.addClass("selected");
|
||||
}
|
||||
|
||||
$ul.append(
|
||||
$("<li/>").append("Artist: ").append(
|
||||
$link = $("<a/>").attr("href", "/artists/" + json.id).html(json.name).click(Danbooru.RelatedTag.toggle_tag)
|
||||
$link
|
||||
)
|
||||
);
|
||||
if (json.other_names.length > 0) {
|
||||
@@ -222,7 +239,6 @@
|
||||
});
|
||||
$div.append($ul);
|
||||
$dest.append($div);
|
||||
$link.trigger("click");
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -24,7 +24,7 @@ div#artist-tags {
|
||||
}
|
||||
}
|
||||
|
||||
div#related-tags {
|
||||
div.related-tags {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
margin-bottom: 1em;
|
||||
@@ -55,4 +55,9 @@ div#related-tags {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.tag-column.artist {
|
||||
float: none;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class Artist < ActiveRecord::Base
|
||||
u = u.to_escaped_for_sql_like.gsub(/\*/, '%') + '%'
|
||||
artists += Artist.joins(:urls).where(["artists.is_active = TRUE AND artist_urls.normalized_url LIKE ? ESCAPE E'\\\\'", u]).all(:order => "artists.name")
|
||||
url = File.dirname(url) + "/"
|
||||
break if url =~ /\.(?:net|com|org)\/$/
|
||||
break if url =~ /pixiv\.net\/$/
|
||||
end
|
||||
|
||||
artists.uniq_by {|x| x.name}.slice(0, 20)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<%= format_text(@pool.description) %>
|
||||
</div>
|
||||
|
||||
<section id="content">
|
||||
<section>
|
||||
<%= @post_set.presenter.post_previews_html(self) %>
|
||||
|
||||
<%= numbered_paginator(@post_set) %>
|
||||
|
||||
@@ -76,13 +76,13 @@
|
||||
|
||||
<div id="artist-tags-container">
|
||||
<h1>Artist</h1>
|
||||
<div id="artist-tags">
|
||||
<div id="artist-tags" class="related-tags">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="related-tags-container">
|
||||
<h1>Related Tags</h1>
|
||||
<div id="related-tags">
|
||||
<div id="related-tags" class="related-tags">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user