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) {
|
Danbooru.RelatedTag.common_bind = function(button_name, category) {
|
||||||
$(button_name).click(function(e) {
|
$(button_name).click(function(e) {
|
||||||
@@ -178,6 +187,9 @@
|
|||||||
|
|
||||||
$field[0].selectionStart = $field.val().length;
|
$field[0].selectionStart = $field.val().length;
|
||||||
Danbooru.RelatedTag.build_all();
|
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();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +202,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.RelatedTag.process_artist = function(data) {
|
Danbooru.RelatedTag.process_artist = function(data) {
|
||||||
|
Danbooru.RelatedTag.recent_artist = data;
|
||||||
$("#artist-tags-container").show();
|
$("#artist-tags-container").show();
|
||||||
var $dest = $("#artist-tags");
|
var $dest = $("#artist-tags");
|
||||||
$dest.empty();
|
$dest.empty();
|
||||||
@@ -206,12 +219,16 @@
|
|||||||
if (!json.other_names) {
|
if (!json.other_names) {
|
||||||
json.other_names = "";
|
json.other_names = "";
|
||||||
}
|
}
|
||||||
var $div = $("<div/>").addClass("artist");
|
var $div = $("<div/>").addClass("tag-column").addClass("artist");
|
||||||
var $ul = $("<ul/>");
|
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(
|
$ul.append(
|
||||||
$("<li/>").append("Artist: ").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) {
|
if (json.other_names.length > 0) {
|
||||||
@@ -222,7 +239,6 @@
|
|||||||
});
|
});
|
||||||
$div.append($ul);
|
$div.append($ul);
|
||||||
$dest.append($div);
|
$dest.append($div);
|
||||||
$link.trigger("click");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ div#artist-tags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div#related-tags {
|
div.related-tags {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 1em;
|
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(/\*/, '%') + '%'
|
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")
|
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) + "/"
|
url = File.dirname(url) + "/"
|
||||||
break if url =~ /\.(?:net|com|org)\/$/
|
break if url =~ /pixiv\.net\/$/
|
||||||
end
|
end
|
||||||
|
|
||||||
artists.uniq_by {|x| x.name}.slice(0, 20)
|
artists.uniq_by {|x| x.name}.slice(0, 20)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<%= format_text(@pool.description) %>
|
<%= format_text(@pool.description) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section id="content">
|
<section>
|
||||||
<%= @post_set.presenter.post_previews_html(self) %>
|
<%= @post_set.presenter.post_previews_html(self) %>
|
||||||
|
|
||||||
<%= numbered_paginator(@post_set) %>
|
<%= numbered_paginator(@post_set) %>
|
||||||
|
|||||||
@@ -76,13 +76,13 @@
|
|||||||
|
|
||||||
<div id="artist-tags-container">
|
<div id="artist-tags-container">
|
||||||
<h1>Artist</h1>
|
<h1>Artist</h1>
|
||||||
<div id="artist-tags">
|
<div id="artist-tags" class="related-tags">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="related-tags-container">
|
<div id="related-tags-container">
|
||||||
<h1>Related Tags</h1>
|
<h1>Related Tags</h1>
|
||||||
<div id="related-tags">
|
<div id="related-tags" class="related-tags">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user