closes #1653
This commit is contained in:
Toks
2013-10-26 00:08:37 -04:00
parent 06995dd11b
commit 11871d88b6
8 changed files with 44 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
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 :builder_only, :only => [:destroy]
before_filter :admin_only, :only => [:ban]
def new
@@ -14,17 +14,6 @@ class ArtistsController < ApplicationController
respond_with(@artist)
end
def edit_name
@artist = Artist.find(params[:id])
respond_with(@artist)
end
def update_name
@artist = Artist.find(params[:id])
@artist.rename!(params[:artist][:name])
respond_with(@artist)
end
def banned
@artists = Artist.where("is_banned = ?", true).order("name")
respond_with(@artists) do |format|
@@ -79,7 +68,12 @@ class ArtistsController < ApplicationController
def update
@artist = Artist.find(params[:id])
@artist.update_attributes(params[:artist], :as => CurrentUser.role)
body = params[:artist].delete("notes")
@artist.assign_attributes(params[:artist], :as => CurrentUser.role)
if body
@artist.notes = body
end
@artist.save
respond_with(@artist)
end