forked from e621ng/e621ng
[Cleanup] Add helper method for show_or_new_wiki_pages_path
This commit is contained in:
parent
5ac5b85150
commit
9b59c860ff
@ -6,25 +6,25 @@ module TagsHelper
|
||||
|
||||
if tag.antecedent_alias
|
||||
html << "<p class='hint'>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_wiki_or_new(tag.antecedent_alias.consequent_name)
|
||||
html << " (#{link_to "learn more", wiki_pages_path(title: "e621:tag_aliases")}).</p>"
|
||||
end
|
||||
|
||||
if tag.consequent_aliases.present?
|
||||
html << "<p class='hint'>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 << raw(tag.consequent_aliases.map {|x| link_to_wiki_or_new(x.antecedent_name) }.join(", "))
|
||||
html << " (#{link_to "learn more", wiki_pages_path(title: "e621:tag_aliases")}).</p>"
|
||||
end
|
||||
|
||||
if tag.antecedent_implications.present?
|
||||
html << "<p class='hint'>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 << raw(tag.antecedent_implications.map {|x| link_to_wiki_or_new(x.consequent_name) }.join(", "))
|
||||
html << " (#{link_to "learn more", wiki_pages_path(title: "e621:tag_implications")}).</p>"
|
||||
end
|
||||
|
||||
if tag.consequent_implications.present?
|
||||
html << "<p class='hint'>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 << raw(tag.consequent_implications.map {|x| link_to_wiki_or_new(x.antecedent_name) }.join(", "))
|
||||
html << " (#{link_to "learn more", wiki_pages_path(title: "e621:tag_implications")}).</p>"
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
module WikiPagesHelper
|
||||
def link_to_wiki_or_new(text, tag = text)
|
||||
link_to(text, show_or_new_wiki_pages_path(title: tag))
|
||||
end
|
||||
|
||||
def wiki_page_alias_and_implication_list(wiki_page)
|
||||
alias_and_implication_list(wiki_page.tag || Tag.new({name: wiki_page.title}))
|
||||
end
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||
<% else %>
|
||||
<p><%= link_to "View wiki page", show_or_new_wiki_pages_path(:title => @artist.name) %></p>
|
||||
<p><%= link_to_wiki_or_new "View wiki page", @artist.name %></p>
|
||||
<% end %>
|
||||
|
||||
<%= artist_alias_and_implication_list(@artist) %>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<% @related_tags.tags_for_html.each do |tag, category| %>
|
||||
<tr>
|
||||
<td class="category-<%= category %>">
|
||||
<%= link_to("?", show_or_new_wiki_pages_path(:title => tag)) %>
|
||||
<%= link_to_wiki_or_new("?", tag) %>
|
||||
<%= link_to(tag, posts_path(:tags => tag)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<h1>Tag Alias: <%= @tag_alias.antecedent_name %> -> <%= @tag_alias.consequent_name %></h1>
|
||||
|
||||
<ul>
|
||||
<li><strong>From</strong> <%= link_to @tag_alias.antecedent_name, show_or_new_wiki_pages_path(:title => @tag_alias.antecedent_name) %></li>
|
||||
<li><strong>To</strong> <%= link_to @tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @tag_alias.consequent_name) %></li>
|
||||
<li><strong>From</strong> <%= link_to_wiki_or_new @tag_alias.antecedent_name %></li>
|
||||
<li><strong>To</strong> <%= link_to_wiki_or_new @tag_alias.consequent_name %></li>
|
||||
<%= render "tag_change_requests/reference", tag_change_request: @tag_alias %>
|
||||
<li><strong>Creator</strong> <%= link_to_user @tag_alias.creator %></li>
|
||||
<li><strong>Date</strong> <%= @tag_alias.created_at %></li>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<h1>Tag Implication: <%= @tag_implication.antecedent_name %> -> <%= @tag_implication.consequent_name %></h1>
|
||||
|
||||
<ul>
|
||||
<li><strong>From</strong> <%= link_to @tag_implication.antecedent_name, show_or_new_wiki_pages_path(:title => @tag_implication.antecedent_name) %></li>
|
||||
<li><strong>To</strong> <%= link_to @tag_implication.consequent_name, show_or_new_wiki_pages_path(:title => @tag_implication.consequent_name) %></li>
|
||||
<li><strong>From</strong> <%= link_to_wiki_or_new @tag_implication.antecedent_name %></li>
|
||||
<li><strong>To</strong> <%= link_to_wiki_or_new @tag_implication.consequent_name %></li>
|
||||
<%= render "tag_change_requests/reference", tag_change_request: @tag_implication %>
|
||||
<li><strong>Creator</strong> <%= link_to_user @tag_implication.creator %></li>
|
||||
<li><strong>Date</strong> <%= @tag_implication.created_at %></li>
|
||||
|
@ -14,11 +14,11 @@
|
||||
<% tag_relations.each do |tag_relation| %>
|
||||
<tr id="<%= tag_relation.model_name.singular_route_key.dasherize %>-<%= tag_relation.id %>">
|
||||
<td class="category-<%= tag_relation.antecedent_tag.try(:category) %>">
|
||||
<%= link_to tag_relation.antecedent_name, show_or_new_wiki_pages_path(title: tag_relation.antecedent_name) %>
|
||||
<%= link_to_wiki_or_new tag_relation.antecedent_name %>
|
||||
<span class="count"><%= tag_relation.antecedent_tag.post_count rescue 0 %></span>
|
||||
</td>
|
||||
<td class="category-<%= tag_relation.consequent_tag.try(:category) %>">
|
||||
<%= link_to tag_relation.consequent_name, show_or_new_wiki_pages_path(title: tag_relation.consequent_name) %>
|
||||
<%= link_to_wiki_or_new tag_relation.consequent_name %>
|
||||
<span class="count"><%= tag_relation.consequent_tag.post_count rescue 0 %></span>
|
||||
<% if tag_relation.is_a?(TagAlias) %>
|
||||
<% if CurrentUser.is_member? && tag_relation.status == "pending" && tag_relation.has_transitives %>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<% if tag.category == Tag.categories.artist %>
|
||||
<%= link_to("?", show_or_new_artists_path(:name => tag.name)) %>
|
||||
<% else %>
|
||||
<%= link_to("?", show_or_new_wiki_pages_path(:title => tag.name)) %>
|
||||
<%= link_to_wiki_or_new("?", tag.name) %>
|
||||
<% end %>
|
||||
<%= link_to(tag.name, posts_path(:tags => tag.name)) %>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user