hide more pages for banned artists #2132
This commit is contained in:
@@ -3,6 +3,7 @@ class ArtistsController < ApplicationController
|
|||||||
before_filter :member_only, :except => [:index, :show, :banned]
|
before_filter :member_only, :except => [:index, :show, :banned]
|
||||||
before_filter :builder_only, :only => [:destroy]
|
before_filter :builder_only, :only => [:destroy]
|
||||||
before_filter :admin_only, :only => [:ban, :unban]
|
before_filter :admin_only, :only => [:ban, :unban]
|
||||||
|
before_filter :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete, :revert]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@artist = Artist.new_with_defaults(params)
|
@artist = Artist.new_with_defaults(params)
|
||||||
@@ -10,7 +11,6 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
respond_with(@artist)
|
respond_with(@artist)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -27,13 +27,11 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ban
|
def ban
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
@artist.ban!
|
@artist.ban!
|
||||||
redirect_to(artist_path(@artist), :notice => "Artist was banned")
|
redirect_to(artist_path(@artist), :notice => "Artist was banned")
|
||||||
end
|
end
|
||||||
|
|
||||||
def unban
|
def unban
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
@artist.unban!
|
@artist.unban!
|
||||||
redirect_to(artist_path(@artist), :notice => "Artist was unbanned")
|
redirect_to(artist_path(@artist), :notice => "Artist was unbanned")
|
||||||
end
|
end
|
||||||
@@ -73,7 +71,6 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
body = params[:artist].delete("notes")
|
body = params[:artist].delete("notes")
|
||||||
@artist.assign_attributes(params[:artist], :as => CurrentUser.role)
|
@artist.assign_attributes(params[:artist], :as => CurrentUser.role)
|
||||||
if body
|
if body
|
||||||
@@ -84,7 +81,6 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
if !@artist.deletable_by?(CurrentUser.user)
|
if !@artist.deletable_by?(CurrentUser.user)
|
||||||
raise User::PrivilegeError
|
raise User::PrivilegeError
|
||||||
end
|
end
|
||||||
@@ -93,7 +89,6 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def undelete
|
def undelete
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
if !@artist.deletable_by?(CurrentUser.user)
|
if !@artist.deletable_by?(CurrentUser.user)
|
||||||
raise User::PrivilegeError
|
raise User::PrivilegeError
|
||||||
end
|
end
|
||||||
@@ -102,7 +97,6 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def revert
|
def revert
|
||||||
@artist = Artist.find(params[:id])
|
|
||||||
@version = ArtistVersion.find(params[:version_id])
|
@version = ArtistVersion.find(params[:version_id])
|
||||||
@artist.revert_to!(@version)
|
@artist.revert_to!(@version)
|
||||||
respond_with(@artist)
|
respond_with(@artist)
|
||||||
@@ -131,4 +125,11 @@ class ArtistsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def load_artist
|
||||||
|
@artist = Artist.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class ArtistVersion < ActiveRecord::Base
|
|||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
belongs_to :artist
|
belongs_to :artist
|
||||||
attr_accessible :artist_id, :name, :is_active, :other_names, :group_name, :url_string, :is_banned, :updater_id, :updater_ip_addr
|
attr_accessible :artist_id, :name, :is_active, :other_names, :group_name, :url_string, :is_banned, :updater_id, :updater_ip_addr
|
||||||
|
delegate :visible?, :to => :artist
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def for_user(user_id)
|
def for_user(user_id)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class WikiPageVersion < ActiveRecord::Base
|
|||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
belongs_to :artist
|
belongs_to :artist
|
||||||
attr_accessible :wiki_page_id, :title, :body, :is_locked, :updater_id, :updater_ip_addr, :version, :other_names
|
attr_accessible :wiki_page_id, :title, :body, :is_locked, :updater_id, :updater_ip_addr, :version, :other_names
|
||||||
|
delegate :visible?, :to => :wiki_page
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def for_user(user_id)
|
def for_user(user_id)
|
||||||
|
|||||||
@@ -24,11 +24,15 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% @artist_versions.each do |artist_version| %>
|
<% @artist_versions.each do |artist_version| %>
|
||||||
<tr class="<%= cycle 'even', 'odd' %>">
|
<tr class="<%= cycle 'even', 'odd' %>">
|
||||||
<td>
|
<% if artist_version.visible? %>
|
||||||
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
|
<td><%= link_to artist_version.name, artist_path(artist_version.artist_id) %></td>
|
||||||
</td>
|
<td><%= artist_version_other_names_diff(artist_version) %></td>
|
||||||
<td><%= artist_version_other_names_diff(artist_version) %></td>
|
<td><%= artist_version.group_name %></td>
|
||||||
<td><%= artist_version.group_name %></td>
|
<% else %>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<% end %>
|
||||||
<td><%= compact_time artist_version.created_at %></td>
|
<td><%= compact_time artist_version.created_at %></td>
|
||||||
<td><%= link_to_user artist_version.updater %></td>
|
<td><%= link_to_user artist_version.updater %></td>
|
||||||
<% if CurrentUser.is_moderator? %>
|
<% if CurrentUser.is_moderator? %>
|
||||||
@@ -37,11 +41,11 @@
|
|||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><%= artist_version.is_active? %></td>
|
<td><%= artist_version.is_active? %></td>
|
||||||
<td>
|
<% if artist_version.visible? %>
|
||||||
<ul>
|
<td><ul><%= artist_version_urls_diff(artist_version) %></ul></td>
|
||||||
<%= artist_version_urls_diff(artist_version) %>
|
<% else %>
|
||||||
</ul>
|
<td></td>
|
||||||
</td>
|
<% end %>
|
||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to "Revert to", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
|
<%= link_to "Revert to", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
<div id="c-artists">
|
<div id="c-artists">
|
||||||
<div id="a-edit">
|
<div id="a-edit">
|
||||||
<h1>Edit Artist</h1>
|
<h1>Edit Artist</h1>
|
||||||
<%= render "form" %>
|
|
||||||
|
<% if @artist.visible? %>
|
||||||
|
<%= render "form" %>
|
||||||
|
<% else %>
|
||||||
|
<p>The artist requested removal of this page.</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div id="a-show">
|
<div id="a-show">
|
||||||
<h1>Artist: <%= link_to @artist.pretty_name, posts_path(:tags => @artist.name), :class => "tag-type-#{@artist.category_name}" %></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?) %>
|
<% if @artist.notes.present? && @artist.visible? %>
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<%= format_text(@artist.notes) %>
|
<%= format_text(@artist.notes) %>
|
||||||
</div>
|
</div>
|
||||||
@@ -10,34 +10,39 @@
|
|||||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
<% if @artist.visible? %>
|
||||||
<ul>
|
<div>
|
||||||
<li><strong>Status</strong> <%= @artist.status %></li>
|
<ul>
|
||||||
|
<li><strong>Status</strong> <%= @artist.status %></li>
|
||||||
|
|
||||||
<% if !@artist.is_banned? || CurrentUser.user.is_member? %>
|
<% if !@artist.is_banned? || CurrentUser.user.is_member? %>
|
||||||
<% if @artist.has_tag_alias? %>
|
<% if @artist.has_tag_alias? %>
|
||||||
<li><strong>Tag Alias</strong> <%= @artist.tag_alias_name %></li>
|
<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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @artist.other_names.present? %>
|
</ul>
|
||||||
<li><strong>Other Names</strong> <%= link_to_artists(@artist.other_names.split(/ /)) %></li>
|
</div>
|
||||||
<% end %>
|
|
||||||
<% if @artist.group_name.present? %>
|
<% else %>
|
||||||
<li><strong>Group</strong> <%= link_to_artist(@artist.group_name) %></li>
|
<p>The artist requested removal of this page.</p>
|
||||||
<% end %>
|
<% 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 %>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "secondary_links" %>
|
<%= render "secondary_links" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,43 +4,45 @@
|
|||||||
|
|
||||||
<div id="excerpt" style="display: none;">
|
<div id="excerpt" style="display: none;">
|
||||||
<% if post_set.has_artist? %>
|
<% if post_set.has_artist? %>
|
||||||
<% unless post_set.artist.notes.blank? %>
|
<% if post_set.artist.visible? %>
|
||||||
<div class="prose">
|
<% unless post_set.artist.notes.blank? %>
|
||||||
<%= format_text(post_set.artist.notes) %>
|
<div class="prose">
|
||||||
|
<%= format_text(post_set.artist.notes) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p><%= link_to "View wiki page", post_set.artist.wiki_page %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Status</strong> <%= post_set.artist.status %></li>
|
||||||
|
<% if post_set.artist.has_tag_alias? %>
|
||||||
|
<li><strong>Tag Alias</strong> <%= post_set.artist.tag_alias_name %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if post_set.artist.other_names.present? %>
|
||||||
|
<li><strong>Other Names</strong> <%= link_to_artists(post_set.artist.other_names.split(/ /)) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if post_set.artist.group_name.present? %>
|
||||||
|
<li><strong>Group</strong> <%= link_to_artist(post_set.artist.group_name) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if post_set.artist.members.any? %>
|
||||||
|
<li><strong>Members</strong> <%= link_to_artists(post_set.artist.members.map(&:name)) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% post_set.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 => "-#{post_set.artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => post_set.artist.name)) %>)
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%= artist_alias_and_implication_list(post_set.artist) %>
|
||||||
|
|
||||||
|
<p><%= link_to "View artist", artist_path(post_set.artist.id) %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><%= link_to "View wiki page", post_set.artist.wiki_page %></p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
|
||||||
<ul>
|
|
||||||
<li><strong>Status</strong> <%= post_set.artist.status %></li>
|
|
||||||
<% if post_set.artist.has_tag_alias? %>
|
|
||||||
<li><strong>Tag Alias</strong> <%= post_set.artist.tag_alias_name %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.other_names.present? %>
|
|
||||||
<li><strong>Other Names</strong> <%= link_to_artists(post_set.artist.other_names.split(/ /)) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.group_name.present? %>
|
|
||||||
<li><strong>Group</strong> <%= link_to_artist(post_set.artist.group_name) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.members.any? %>
|
|
||||||
<li><strong>Members</strong> <%= link_to_artists(post_set.artist.members.map(&:name)) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% post_set.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 => "-#{post_set.artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => post_set.artist.name)) %>)
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<%= artist_alias_and_implication_list(post_set.artist) %>
|
|
||||||
|
|
||||||
<p><%= link_to "View artist", artist_path(post_set.artist.id) %></p>
|
|
||||||
</div>
|
|
||||||
<% elsif post_set.has_wiki? %>
|
<% elsif post_set.has_wiki? %>
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<% if post_set.wiki_page.other_names.present? %>
|
<% if post_set.wiki_page.other_names.present? %>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<% if post.is_banned? %>
|
<% if post.is_banned? %>
|
||||||
<div class="ui-corner-all ui-state-highlight notice notice-deleted">
|
<div class="ui-corner-all ui-state-highlight notice notice-deleted">
|
||||||
This post was removed because it was requested by the artist
|
The artist requested removal of this page
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<h1>Access Denied</h1>
|
<h1>Access Denied</h1>
|
||||||
|
|
||||||
|
<p>You do not have permission to visit this page.</p>
|
||||||
|
|
||||||
<%= link_to "Go back", :back, :rel => "prev" %>
|
<%= link_to "Go back", :back, :rel => "prev" %>
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
<% content_for(:page_title) do %>
|
||||||
|
|||||||
@@ -2,11 +2,15 @@
|
|||||||
<div id="a-diff">
|
<div id="a-diff">
|
||||||
<h1>Wiki Page: <%= @thispage.title %></h1>
|
<h1>Wiki Page: <%= @thispage.title %></h1>
|
||||||
|
|
||||||
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
|
<% if @thispage.visible? %>
|
||||||
|
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= wiki_page_diff(@thispage, @otherpage) %>
|
<%= wiki_page_diff(@thispage, @otherpage) %>
|
||||||
</div>
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p>The artist requested removal of this page.</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<%= format_text(@wiki_page_version.body) %>
|
<%= format_text(@wiki_page_version.body) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p>This artist has requested removal of their information.</p>
|
<p>The artist has requested removal of this page.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
|
|
||||||
<section id="content">
|
<section id="content">
|
||||||
<h1>Edit Wiki</h1>
|
<h1>Edit Wiki</h1>
|
||||||
<%= render "form" %>
|
|
||||||
|
<% if @wiki_page.visible? %>
|
||||||
|
<%= render "form" %>
|
||||||
|
<% else %>
|
||||||
|
<p>The artist requested removal of this page.</p>
|
||||||
|
<% end %>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user