From 5422db1c3cfc891820434637a7b1c6d466586c1a Mon Sep 17 00:00:00 2001
From: evazion
Date: Thu, 31 Oct 2019 02:44:08 -0500
Subject: [PATCH] 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.
---
app/helpers/application_helper.rb | 8 ++++--
app/helpers/posts_helper.rb | 4 +--
app/helpers/tags_helper.rb | 10 +++----
app/views/artist_commentaries/_form.html.erb | 2 +-
.../_secondary_links.html.erb | 2 +-
app/views/comments/_index_by_post.html.erb | 2 +-
app/views/comments/_secondary_links.html.erb | 2 +-
app/views/dmails/_secondary_links.html.erb | 2 +-
app/views/dtext/_form.html.erb | 2 +-
.../favorite_groups/_secondary_links.html.erb | 2 +-
.../forum_topics/_secondary_links.html.erb | 2 +-
.../moderator/post/queues/_desc.html.erb | 4 +--
app/views/notes/_secondary_links.html.erb | 2 +-
app/views/pools/_secondary_links.html.erb | 2 +-
.../partials/common/_secondary_links.html.erb | 2 +-
.../posts/partials/index/_blacklist.html.erb | 2 +-
.../posts/partials/index/_posts.html.erb | 6 ++---
.../posts/partials/show/_embedded.html.erb | 2 +-
.../posts/partials/show/_notices.html.erb | 6 ++---
app/views/posts/show.html.erb | 2 +-
app/views/static/site_map.html.erb | 26 +++++++++----------
app/views/static/terms_of_service.html.erb | 2 +-
.../tag_aliases/_secondary_links.html.erb | 2 +-
.../_secondary_links.html.erb | 2 +-
app/views/tags/_secondary_links.html.erb | 4 +--
app/views/uploads/_secondary_links.html.erb | 2 +-
app/views/user_feedbacks/new.html.erb | 2 +-
.../_secondary_links.html.erb | 2 +-
app/views/users/_statistics.html.erb | 4 +--
app/views/wiki_pages/_form.html.erb | 2 +-
.../wiki_pages/_secondary_links.html.erb | 2 +-
31 files changed, 60 insertions(+), 56 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e19ce5f1b..32e64f6a4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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)
diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
index 2ce2f0143..3bde965c6 100644
--- a/app/helpers/posts_helper.rb
+++ b/app/helpers/posts_helper.rb
@@ -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("« 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("« hide".html_safe, "#", :id => "has-children-relationship-preview-link")
diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb
index d0d754482..35fe58b86 100644
--- a/app/helpers/tags_helper.rb
+++ b/app/helpers/tags_helper.rb
@@ -7,32 +7,32 @@ module TagsHelper
if tag.antecedent_alias
html << "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")}).
"
+ html << " (#{link_to_wiki "learn more", "help:tag_aliases"}).
"
end
if tag.consequent_aliases.present?
html << "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")}).
"
+ html << " (#{link_to_wiki "learn more", "help:tag_aliases"})."
end
automatic_tags = TagImplication.automatic_tags_for([tag.name])
if automatic_tags.present?
html << "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")}).
"
+ html << " (#{link_to_wiki "learn more", "help:autotags"})."
end
if tag.antecedent_implications.present?
html << "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")}).
"
+ html << " (#{link_to_wiki "learn more", "help:tag_implications"})."
end
if tag.consequent_implications.present?
html << "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")}).
"
+ html << " (#{link_to_wiki "learn more", "help:tag_implications"})."
end
html.html_safe
diff --git a/app/views/artist_commentaries/_form.html.erb b/app/views/artist_commentaries/_form.html.erb
index dee5c5a0a..249962a9e 100644
--- a/app/views/artist_commentaries/_form.html.erb
+++ b/app/views/artist_commentaries/_form.html.erb
@@ -1,4 +1,4 @@
-If the artist of this image posted some interesting additional information about this work, you can copy it here. <%= link_to "View help.", wiki_pages_path(:search => {:title => "help:artist_commentary"}) %>
+If the artist of this image posted some interesting additional information about this work, you can copy it here (<%= link_to_wiki "learn more", "help:artist_commentary" %>).