views: convert helpers to partials.

This commit is contained in:
evazion
2020-01-11 20:01:14 -06:00
parent 153a8339ab
commit abacc8ebb1
12 changed files with 64 additions and 87 deletions

View File

@@ -1,8 +1,4 @@
module ArtistsHelper
def artist_alias_and_implication_list(artist)
alias_and_implication_list(artist.tag)
end
def link_to_artist(name)
artist = Artist.find_by_name(name)

View File

@@ -1,2 +0,0 @@
module ForumPostVotesControllerHelper
end

View File

@@ -1,40 +0,0 @@
module TagsHelper
def alias_and_implication_list(tag)
return "" if tag.nil?
html = ""
if tag.antecedent_alias
html << "<p class='fineprint'>This tag has been aliased to "
html << link_to_wiki(tag.antecedent_alias.consequent_name)
html << " (#{link_to_wiki "learn more", "help:tag_aliases"}).</p>"
end
if tag.consequent_aliases.present?
html << "<p class='fineprint'>The following tags are aliased to this tag: "
html << raw(tag.consequent_aliases.map {|x| link_to_wiki x.antecedent_name }.join(", "))
html << " (#{link_to_wiki "learn more", "help:tag_aliases"}).</p>"
end
automatic_tags = TagImplication.automatic_tags_for([tag.name])
if automatic_tags.present?
html << "<p class='fineprint'>This tag automatically adds "
html << raw(automatic_tags.map {|x| link_to_wiki x, x }.join(", "))
html << " (#{link_to_wiki "learn more", "help:autotags"}).</p>"
end
if tag.antecedent_implications.present?
html << "<p class='fineprint'>This tag implicates "
html << raw(tag.antecedent_implications.map {|x| link_to_wiki x.consequent_name }.join(", "))
html << " (#{link_to_wiki "learn more", "help:tag_implications"}).</p>"
end
if tag.consequent_implications.present?
html << "<p class='fineprint'>The following tags implicate this tag: "
html << raw(tag.consequent_implications.map {|x| link_to_wiki x.antecedent_name }.join(", "))
html << " (#{link_to_wiki "learn more", "help:tag_implications"}).</p>"
end
html.html_safe
end
end

View File

@@ -1,15 +0,0 @@
module UploadTagsReportHelper
def diff_to_current(report)
html = '<span class="diff-list">'
report.added_tags_array.each do |tag|
html << '<ins>+' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</ins>'
end
report.removed_tags_array.each do |tag|
html << '<del>-' + link_to(wordbreakify(tag), posts_path(:tags => tag)) + '</del>'
end
html << "</span>"
html.html_safe
end
end

View File

@@ -1,22 +1,4 @@
module WikiPagesHelper
def wiki_page_alias_and_implication_list(wiki_page)
alias_and_implication_list(wiki_page.tag)
end
def wiki_page_post_previews(wiki_page)
html = '<div id="wiki-page-posts">'
if Post.fast_count(wiki_page.title) > 0
full_link = link_to("view all", posts_path(:tags => wiki_page.title))
html << "<h2>Posts (#{full_link})</h2>"
html << wiki_page.post_set.presenter.post_previews_html(self)
end
html << "</div>"
html.html_safe
end
def wiki_page_other_names_list(wiki_page)
names_html = wiki_page.other_names.map {|name| link_to(name, "http://www.pixiv.net/search.php?s_mode=s_tag_full&word=#{u(name)}", :class => "wiki-other-name")}
names_html.join(" ").html_safe