fixes #280
This commit is contained in:
@@ -47,6 +47,10 @@ module PostSets
|
||||
tag_array.size == 0
|
||||
end
|
||||
|
||||
def is_pattern_search?
|
||||
tag_string =~ /\*/
|
||||
end
|
||||
|
||||
def current_page
|
||||
[page.to_i, 1].max
|
||||
end
|
||||
|
||||
@@ -195,7 +195,7 @@ class Tag < ActiveRecord::Base
|
||||
output[:include] << tag[1..-1]
|
||||
|
||||
elsif tag =~ /\*/
|
||||
matches = Tag.name_matches(tag).all(:select => "name", :limit => 25, :order => "post_count DESC").map(&:name)
|
||||
matches = Tag.name_matches(tag).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name)
|
||||
matches = ["~no_matches~"] if matches.empty?
|
||||
output[:include] += matches
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ module PostSetPresenters
|
||||
end
|
||||
|
||||
def related_tags
|
||||
if post_set.is_single_tag?
|
||||
if post_set.is_pattern_search?
|
||||
pattern_tags
|
||||
elsif post_set.is_single_tag?
|
||||
related_tags_for_single
|
||||
elsif post_set.is_empty_tag?
|
||||
popular_tags
|
||||
@@ -31,6 +33,10 @@ module PostSetPresenters
|
||||
results
|
||||
end
|
||||
|
||||
def pattern_tags
|
||||
Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name)
|
||||
end
|
||||
|
||||
def related_tags_for_group
|
||||
RelatedTagCalculator.calculate_from_sample_to_array(post_set.tag_string).map(&:first)
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ class TagSetPresenter < Presenter
|
||||
def tag_list_html(template, options = {})
|
||||
html = ""
|
||||
html << "<ul>"
|
||||
@tags.each do |tag|
|
||||
Array(@tags).each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
html << "</ul>"
|
||||
|
||||
Reference in New Issue
Block a user