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