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