Make large wiki/artist/pool title link to tag search

This commit is contained in:
Toks
2014-10-13 17:44:40 -04:00
parent af4810bcd0
commit ed6b08e65b
5 changed files with 14 additions and 4 deletions

View File

@@ -77,6 +77,10 @@ class Artist < ActiveRecord::Base
self.name = Artist.normalize_name(name)
end
def pretty_name
name.tr("_", " ")
end
def other_names_array
other_names.try(:split, /\s/)
end
@@ -223,6 +227,10 @@ class Artist < ActiveRecord::Base
TagAlias.active.find_by_antecedent_name(name).consequent_name
end
def category_name
Tag.category_for(name)
end
def categorize_tag
if new_record? || name_changed?
Tag.find_or_create_by_name("artist:#{name}")

View File

@@ -1,6 +1,6 @@
<div id="c-artists">
<div id="a-show">
<h1>Artist: <%= @artist.name.tr("_", " ") %></h1>
<h1>Artist: <%= link_to @artist.pretty_name, posts_path(:tags => @artist.name), :class => "tag-type-#{@artist.category_name}" %></h1>
<% if @artist.notes.present? && (!@artist.is_banned? || CurrentUser.user.is_member?) %>
<div class="prose">

View File

@@ -2,7 +2,7 @@
<div id="a-show">
<h1>
<%= @pool.pretty_category %>:
<%= link_to @pool.pretty_name, pool_path(@pool), :class => "pool-category-#{@pool.category}" %>
<%= link_to @pool.pretty_name, posts_path(:tags => "pool:#{@pool.id}"), :class => "pool-category-#{@pool.category}" %>
<% if @pool.is_deleted? %>
<span class="inactive">(deleted)</span>
<% end %>

View File

@@ -5,7 +5,7 @@
<section id="content">
<h1 id="wiki-page-title">
<%= link_to @wiki_page.pretty_title, wiki_page_path(@wiki_page), :class => "tag-type-#{@wiki_page.category_name}" %>
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
<% if @wiki_page.is_locked? %>
(locked)

View File

@@ -3,7 +3,9 @@
<%= render "sidebar" %>
<section id="content">
<h1 id="wiki-page-title"><%= @wiki_page.pretty_title %></h1>
<h1 id="wiki-page-title">
<%= link_to @wiki_page.pretty_title, posts_path(:tags => @wiki_page.title), :class => "tag-type-#{@wiki_page.category_name}" %>
</h1>
<div id="wiki-page-body" class="prose">
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
</div>