This commit is contained in:
Toks
2013-06-05 13:09:14 -04:00
parent a9708b9efa
commit 6f2d57882e
5 changed files with 35 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
class ArtistsController < ApplicationController
respond_to :html, :xml, :json
before_filter :member_only, :except => [:index, :show, :banned]
before_filter :builder_only, :only => [:edit_name, :update_name, :destroy]
before_filter :admin_only, :only => [:ban]
before_filter :builder_only, :only => [:edit_name, :update_name]
def new
@artist = Artist.new_with_defaults(params)
@@ -82,6 +82,24 @@ class ArtistsController < ApplicationController
respond_with(@artist)
end
def destroy
@artist = Artist.find(params[:id])
if !@artist.deletable_by?(CurrentUser.user)
raise User::PrivilegeError
end
@artist.update_attribute(:is_active, false)
respond_with(@artist, :notice => "Artist deleted")
end
def undelete
@artist = Artist.find(params[:id])
if !@artist.deletable_by?(CurrentUser.user)
raise User::PrivilegeError
end
@artist.update_attribute(:is_active, true)
respond_with(@artist, :notice => "Artist undeleted")
end
def revert
@artist = Artist.find(params[:id])
@version = ArtistVersion.find(params[:version_id])