Standardize links to wiki help pages.

* Fix inconsistencies in how wiki pages were linked.

* Link directly to the wiki instead of to a title search that is expected
  to redirect to the wiki.
This commit is contained in:
evazion
2019-10-31 02:44:08 -05:00
parent a8fc2ba508
commit 5422db1c3c
31 changed files with 60 additions and 56 deletions

View File

@@ -103,9 +103,13 @@ module ApplicationHelper
link_to search, posts_path(tags: search)
end
def link_to_wiki(*wiki_titles, **options)
def link_to_wiki(text, title)
link_to text, wiki_page_path(title)
end
def link_to_wikis(*wiki_titles, last_word_connector: ", or", **options)
links = wiki_titles.map do |title|
link_to title.tr("_", " "), wiki_pages_path(title: title)
link_to title.tr("_", " "), wiki_page_path(title)
end
to_sentence(links, **options)

View File

@@ -85,7 +85,7 @@ module PostsHelper
html << link_to(text, posts_path(:tags => "parent:#{post.parent_id}"))
end
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
html << " (#{link_to_wiki "learn more", "help:post_relationships"}) "
html << link_to("&laquo; hide".html_safe, "#", :id => "has-parent-relationship-preview-link")
@@ -99,7 +99,7 @@ module PostsHelper
text = children_post_set.children.count == 1 ? "a child" : "#{children_post_set.children.count} children"
html << link_to(text, posts_path(:tags => "parent:#{post.id}"))
html << " (#{link_to("learn more", wiki_pages_path(:title => "help:post_relationships"))}) "
html << " (#{link_to_wiki "learn more", "help:post_relationships"}) "
html << link_to("&laquo; hide".html_safe, "#", :id => "has-children-relationship-preview-link")

View File

@@ -7,32 +7,32 @@ module TagsHelper
if tag.antecedent_alias
html << "<p class='fineprint'>This tag has been aliased to "
html << link_to(tag.antecedent_alias.consequent_name, show_or_new_wiki_pages_path(:title => tag.antecedent_alias.consequent_name))
html << " (#{link_to "learn more", wiki_pages_path(title: "help:tag_aliases")}).</p>"
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(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", "))
html << " (#{link_to "learn more", wiki_pages_path(title: "help:tag_aliases")}).</p>"
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(x, show_or_new_wiki_pages_path(:title => x))}.join(", "))
html << " (#{link_to "learn more", wiki_pages_path(title: "help:autotags")}).</p>"
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(x.consequent_name, show_or_new_wiki_pages_path(:title => x.consequent_name))}.join(", "))
html << " (#{link_to "learn more", wiki_pages_path(title: "help:tag_implications")}).</p>"
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(x.antecedent_name, show_or_new_wiki_pages_path(:title => x.antecedent_name))}.join(", "))
html << " (#{link_to "learn more", wiki_pages_path(title: "help:tag_implications")}).</p>"
html << " (#{link_to_wiki "learn more", "help:tag_implications"}).</p>"
end
html.html_safe