diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index d690fbf12..c66e3ea71 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -1,6 +1,7 @@ class ArtistsController < ApplicationController respond_to :html, :xml, :json before_filter :member_only, :except => [:index, :show, :banned] + before_filter :admin_only, :only => [:ban] def new @artist = Artist.new_with_defaults(params) @@ -17,6 +18,12 @@ class ArtistsController < ApplicationController respond_with(@artists) end + def ban + @artist = Artist.find(params[:id]) + @artist.ban! + redirect_to(artist_path(@artist), :notice => "Artist was banned") + end + def index @artists = Artist.search(params[:search]).order("id desc").paginate(params[:page]) respond_with(@artists) do |format| diff --git a/app/models/artist.rb b/app/models/artist.rb index 82020c563..55d15a8e1 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -3,7 +3,6 @@ class Artist < ActiveRecord::Base before_save :normalize_name after_save :create_version after_save :save_url_string - after_save :commit_ban validates_uniqueness_of :name belongs_to :creator, :class_name => "User" has_many :members, :class_name => "Artist", :foreign_key => "group_name", :primary_key => "name" @@ -162,14 +161,6 @@ class Artist < ActiveRecord::Base end module BanMethods - def commit_ban - if is_banned? && is_banned_changed? - ban! - end - - true - end - def ban! Post.transaction do begin diff --git a/app/views/artists/_form.html.erb b/app/views/artists/_form.html.erb index caec2f855..f8c6a81c2 100644 --- a/app/views/artists/_form.html.erb +++ b/app/views/artists/_form.html.erb @@ -5,10 +5,6 @@ <%= f.input :url_string, :label => "URLs", :as => :text, :input_html => {:size => "50x5"} %> <%= f.input :is_active %> - <% if CurrentUser.is_admin? %> - <%= f.input :is_banned %> - <% end %> - <%= dtext_field "artist", "notes" %> <%= f.button :submit, "Submit" %> <%= dtext_preview_button "artist", "notes" %> diff --git a/app/views/artists/_secondary_links.html.erb b/app/views/artists/_secondary_links.html.erb index 909b892de..271a78e45 100644 --- a/app/views/artists/_secondary_links.html.erb +++ b/app/views/artists/_secondary_links.html.erb @@ -11,6 +11,9 @@