add tags to post file urls

This commit is contained in:
r888888888
2016-05-23 11:50:26 -07:00
parent 8bf743810c
commit a90750f5e1
3 changed files with 47 additions and 45 deletions

View File

@@ -104,34 +104,7 @@ class PostPresenter < Presenter
end
def humanized_essential_tag_string
string = []
if @post.character_tags.any?
chartags = @post.character_tags.slice(0, 5)
if @post.character_tags.length > 5
chartags << "others"
end
chartags = chartags.map do |tag|
tag.match(/^(.+?)(?:_\(.+\))?$/)[1]
end
string << chartags.to_sentence
end
if @post.copyright_tags.any?
copytags = @post.copyright_tags.slice(0, 5)
if @post.copyright_tags.length > 5
copytags << "others"
end
copytags = copytags.to_sentence
string << (@post.character_tags.any? ? "(#{copytags})" : copytags)
end
if @post.artist_tags_excluding_hidden.any?
string << "drawn by"
string << @post.artist_tags_excluding_hidden.to_sentence
end
string.empty? ? "##{@post.id}" : string.join(" ").tr("_", " ")
@post.humanized_essential_tag_string
end
def categorized_tag_string