Archived
add forum group destroying, fix forum destroy redirect
This commit is contained in:
@@ -56,6 +56,19 @@ class ForumgroupsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if admin?
|
||||||
|
if @group.destroy
|
||||||
|
flash[:notice] = "forum group deleted."
|
||||||
|
else
|
||||||
|
flash[:alert] = "Something went wrong"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to delete forum groups."
|
||||||
|
end
|
||||||
|
redirect_to forums_path
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def group_params(add = [])
|
def group_params(add = [])
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class ForumsController < ApplicationController
|
|||||||
flash[:notice] = "Forum deleted."
|
flash[:notice] = "Forum deleted."
|
||||||
else
|
else
|
||||||
flash[:alert] = "Something went wrong"
|
flash[:alert] = "Something went wrong"
|
||||||
render :new
|
redirect_to @forum
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user