Moved most of the tag category config logic to the config file

-Fixed an unused Post class method (fix_post_counts) that didn't have a parameter
This commit is contained in:
BrokenEagle
2017-11-05 23:17:32 -08:00
parent 9f4daf7d2f
commit 1e5540f3a0
6 changed files with 129 additions and 208 deletions

View File

@@ -129,48 +129,24 @@ class PostPresenter < Presenter
@post.humanized_essential_tag_string
end
def categorized_tag_string
def categorized_tag_groups
string = []
if @post.copyright_tags.any?
string << @post.copyright_tags.join(" ")
Danbooru.config.categorized_tag_list.each do |category|
if @post.typed_tags(category).any?
string << @post.typed_tags(category).join(" ")
end
end
string
end
if @post.character_tags.any?
string << @post.character_tags.join(" ")
end
if @post.artist_tags.any?
string << @post.artist_tags.join(" ")
end
if @post.general_tags.any?
string << @post.general_tags.join(" ")
end
string.join(" \n")
def categorized_tag_string
categorized_tag_groups.join(" \n")
end
def humanized_categorized_tag_string
string = []
if @post.copyright_tags.any?
string << @post.copyright_tags
end
if @post.character_tags.any?
string << @post.character_tags
end
if @post.artist_tags.any?
string << @post.artist_tags
end
if @post.general_tags.any?
string << @post.general_tags
end
string.flatten.slice(0, 25).join(", ").tr("_", " ")
categorized_tag_groups.flatten.slice(0, 25).join(", ").tr("_", " ")
end
def image_html(template)