add forum group destroying, fix forum destroy redirect
This commit is contained in:
@@ -56,6 +56,19 @@ class ForumgroupsController < ApplicationController
|
||||
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
|
||||
|
||||
def group_params(add = [])
|
||||
|
||||
@@ -63,7 +63,7 @@ class ForumsController < ApplicationController
|
||||
flash[:notice] = "Forum deleted."
|
||||
else
|
||||
flash[:alert] = "Something went wrong"
|
||||
render :new
|
||||
redirect_to @forum
|
||||
return
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user