fix artist other names
This commit is contained in:
@@ -12,7 +12,7 @@ class Artist < ActiveRecord::Base
|
||||
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
||||
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
|
||||
accepts_nested_attributes_for :wiki_page
|
||||
attr_accessible :body, :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_active, :as => [:member, :privileged, :platinum, :contributor, :janitor, :moderator, :default, :admin]
|
||||
attr_accessible :body, :name, :url_string, :other_names, :other_names_comma, :group_name, :wiki_page_attributes, :notes, :is_active, :as => [:member, :privileged, :platinum, :contributor, :janitor, :moderator, :default, :admin]
|
||||
attr_accessible :is_banned, :as => :admin
|
||||
|
||||
module UrlMethods
|
||||
@@ -64,9 +64,18 @@ class Artist < ActiveRecord::Base
|
||||
|
||||
def normalize_name
|
||||
self.name = Artist.normalize_name(name)
|
||||
if other_names
|
||||
self.other_names = other_names.split(/,/).map {|x| Artist.normalize_name(x)}.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
def other_names_array
|
||||
other_names.split(/ /)
|
||||
end
|
||||
|
||||
def other_names_comma
|
||||
other_names_array.join(", ")
|
||||
end
|
||||
|
||||
def other_names_comma=(string)
|
||||
self.other_names = string.split(/,/).map {|x| Artist.normalize_name(x)}.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= simple_form_for(@artist) do |f| %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :other_names, :hint => "Separate with commas", :as => :text %>
|
||||
<%= f.input :other_names_comma, :hint => "Separate with commas", :as => :text, :label => "Other names" %>
|
||||
<%= f.input :group_name %>
|
||||
<%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5"} %>
|
||||
<%= f.input :is_active %>
|
||||
|
||||
@@ -9,57 +9,29 @@
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%">Status</th>
|
||||
<td width="85%"><%= @artist.status %></td>
|
||||
</tr>
|
||||
<% if @artist.has_tag_alias? %>
|
||||
<tr>
|
||||
<th>Tag Alias</th>
|
||||
<td>
|
||||
<%= @artist.tag_alias_name %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@artist.other_names.blank? %>
|
||||
<tr>
|
||||
<th>Other Names</th>
|
||||
<td>
|
||||
<%= link_to_artists(@artist.other_names.split(/,/)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@artist.group_name.blank? %>
|
||||
<tr>
|
||||
<th>Group</th>
|
||||
<td>
|
||||
<%= link_to_artist(@artist.group_name) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @artist.members.any? %>
|
||||
<tr>
|
||||
<th>Members</th>
|
||||
<td>
|
||||
<%= link_to_artists(@artist.members.map(&:name)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% @artist.urls.each do |url| %>
|
||||
<tr>
|
||||
<th>URLs</th>
|
||||
<td>
|
||||
<%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<ul>
|
||||
<li><strong>Status</strong> <%= @artist.status %></li>
|
||||
<% if @artist.has_tag_alias? %>
|
||||
<li><strong>Tag Alias</strong> <%= @artist.tag_alias_name %></li>
|
||||
<% end %>
|
||||
<% if @artist.other_names.present? %>
|
||||
<li><strong>Other Names</strong> <%= link_to_artists(@artist.other_names.split(/ /)) %></li>
|
||||
<% end %>
|
||||
<% if @artist.group_name.present? %>
|
||||
<li><strong>Group</strong> <%= link_to_artist(@artist.group_name) %></li>
|
||||
<% end %>
|
||||
<% if @artist.members.any? %>
|
||||
<li><strong>Members</strong> <%= link_to_artists(@artist.members.map(&:name)) %></li>
|
||||
<% end %>
|
||||
<% @artist.urls.each do |url| %>
|
||||
<li>
|
||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="recent-posts">
|
||||
|
||||
Reference in New Issue
Block a user