This commit is contained in:
r888888888
2014-03-07 16:42:20 -08:00
parent 08b9b2771f
commit 0724f6ca06
5 changed files with 42 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ class ArtistsController < ApplicationController
respond_to :html, :xml, :json
before_filter :member_only, :except => [:index, :show, :banned]
before_filter :builder_only, :only => [:destroy]
before_filter :admin_only, :only => [:ban]
before_filter :admin_only, :only => [:ban, :unban]
def new
@artist = Artist.new_with_defaults(params)
@@ -32,6 +32,12 @@ class ArtistsController < ApplicationController
redirect_to(artist_path(@artist), :notice => "Artist was banned")
end
def unban
@artist = Artist.find(params[:id])
@artist.unban!
redirect_to(artist_path(@artist), :notice => "Artist was unbanned")
end
def index
search_params = params[:search].present? ? params[:search] : params
@artists = Artist.search(search_params).order("id desc").paginate(params[:page], :limit => params[:limit])