Added list_of_* wikis to copyright related tag response
This commit is contained in:
@@ -124,6 +124,7 @@
|
||||
var query = Danbooru.RelatedTag.recent_search.query;
|
||||
var related_tags = Danbooru.RelatedTag.recent_search.tags;
|
||||
var wiki_page_tags = Danbooru.RelatedTag.recent_search.wiki_page_tags;
|
||||
var other_wikis = Danbooru.RelatedTag.recent_search.other_wikis;
|
||||
var $dest = $("#related-tags");
|
||||
$dest.empty();
|
||||
|
||||
@@ -134,6 +135,9 @@
|
||||
if (wiki_page_tags.length) {
|
||||
$dest.append(Danbooru.RelatedTag.build_html("wiki:" + query, wiki_page_tags, "wiki"));
|
||||
}
|
||||
$.each(other_wikis, function(i,wiki) {
|
||||
$dest.append(Danbooru.RelatedTag.build_html("wiki:" + wiki.title, wiki.wiki_page_tags, "otherwiki" + i.toString()));
|
||||
});
|
||||
if (Danbooru.RelatedTag.recent_artists) {
|
||||
var tags = [];
|
||||
if (Danbooru.RelatedTag.recent_artists.length === 0) {
|
||||
|
||||
@@ -26,12 +26,26 @@ class RelatedTagQuery
|
||||
results
|
||||
end
|
||||
|
||||
def other_wiki_category_tags
|
||||
if Tag.category_for(query) != Tag.categories.copyright
|
||||
return []
|
||||
end
|
||||
listtags = (wiki_page.try(:tags) || []).select {|name| name =~ /^list_of_/i }
|
||||
results = listtags.map do |name|
|
||||
listlinks = WikiPage.titled(name).first.try(:tags) || []
|
||||
if listlinks.length > 0
|
||||
{"title" => name, "wiki_page_tags" => map_with_category_data(listlinks)}
|
||||
end
|
||||
end
|
||||
results.reject {|list| list.nil?}
|
||||
end
|
||||
|
||||
def tags_for_html
|
||||
map_with_category_data(tags)
|
||||
end
|
||||
|
||||
def to_json
|
||||
{:query => query, :category => category, :tags => map_with_category_data(tags), :wiki_page_tags => map_with_category_data(wiki_page_tags)}.to_json
|
||||
{:query => query, :category => category, :tags => map_with_category_data(tags), :wiki_page_tags => map_with_category_data(wiki_page_tags), :other_wikis => other_wiki_category_tags}.to_json
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
Reference in New Issue
Block a user