This commit is contained in:
albert
2010-11-19 16:24:17 -05:00
parent a156cc8c62
commit c6304c6e08
41 changed files with 346 additions and 53 deletions

View File

@@ -33,8 +33,7 @@ class AdvertisementsController < ApplicationController
def create
@advertisement = Advertisement.new(params[:advertisement])
if @advertisement.save
flash[:notice] = "Advertisement created"
redirect_to advertisement_path(@advertisement)
redirect_to advertisement_path(@advertisement), :notice => "Advertisement created"
else
flash[:notice] = "There were errors"
render :action => "new"
@@ -44,8 +43,7 @@ class AdvertisementsController < ApplicationController
def update
@advertisement = Advertisement.find(params[:id])
if @advertisement.update_attributes(params[:advertisement])
flash[:notice] = "Advertisement updated"
redirect_to advertisement_path(@advertisement)
redirect_to advertisement_path(@advertisement), :notice => "Advertisement updated"
else
flash[:notice] = "There were errors"
render :action => "edit"
@@ -55,6 +53,6 @@ class AdvertisementsController < ApplicationController
def destroy
@advertisement = Advertisement.find(params[:id])
@advertisement.destroy
redirect_to advertisements_path
redirect_to advertisements_path, :notice => "Advertisement destroyed"
end
end

View File

@@ -27,7 +27,7 @@ class ArtistsController < ApplicationController
@artist = Artist.create(params[:artist])
if @artist.errors.empty?
redirect_to artist_path(@artist)
redirect_to artist_path(@artist), :notice => "Artist created"
else
flash[:notice] = "There were errors"
render :action => "new"
@@ -39,7 +39,7 @@ class ArtistsController < ApplicationController
@artist.update_attributes(params[:artist])
if @artist.errors.empty?
redirect_to artist_path(@artist)
redirect_to artist_path(@artist), :notice => "Artist updated"
else
flash[:notice] = "There were errors"
render :action => "edit"
@@ -49,6 +49,6 @@ class ArtistsController < ApplicationController
def revert
@artist = Artist.find(params[:id])
@artist.revert_to!(params[:version])
redirect_to artist_path(@artist)
redirect_to artist_path(@artist), :notice => "Artist updated"
end
end

View File

@@ -1,4 +1,6 @@
class BansController < ApplicationController
before_filter :moderator_only, :except => [:show, :index]
def new
@ban = Ban.new
end
@@ -19,7 +21,7 @@ class BansController < ApplicationController
def create
@ban = Ban.new(params[:ban])
if @ban.save
redirect_to ban_path(@ban)
redirect_to ban_path(@ban), :notice => "Ban created"
else
render :action => "new"
end
@@ -28,9 +30,14 @@ class BansController < ApplicationController
def update
@ban = Ban.find(params[:id])
if @ban.update_attributes(params[:ban])
redirect_to ban_path(@ban)
redirect_to ban_path(@ban), :notice => "Ban updated"
else
render :action => "edit"
end
end
def destroy
@ban = Ban.find(params[:id])
@ban.destroy
end
end

View File

@@ -5,7 +5,4 @@ class CommentVotesController < ApplicationController
rescue CommentVote::Error => x
@error = x
end
def destroy
end
end

View File

@@ -1,13 +1,41 @@
class DmailsController < ApplicationController
respond_to :html, :xml, :json
rescue_from User::PrivilegeError, :with => "static/access_denied"
def new
@dmail = Dmail.new(params[:dmail])
respond_width(@dmail)
end
def index
@search = Dmail.search(params[:search])
@dmails = @search.paginate(:page => params[:page])
@dmails.each {|x| check_privilege(x)}
respond_with(@dmails)
end
def show
@dmail = Dmail.find(params[:id])
check_privilege(@dmail)
respond_with(@dmail)
end
def create
end
@dmail = Dmail.create_split(params[:dmail])
respond_with(@dmail)
end
def destroy
@dmail = Dmail.find(params[:id])
check_privilege(@dmail)
@dmail.destroy
redirect_to dmails_path, :notice => "Message destroyed"
end
private
def check_privilege(dmail)
if !dmail.visible_to?(CurrentUser.user)
raise User::PrivilegeError
end
end
end

View File

@@ -0,0 +1,2 @@
class IpBansController < ApplicationController
end

View File

@@ -0,0 +1,2 @@
class StaticController < ApplicationController
end