This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
redstoner.com/app/controllers/forumgroups_controller.rb
2014-04-04 01:08:17 +02:00

61 lines
1.2 KiB
Ruby

class ForumgroupsController < ApplicationController
def index
redirect_to forums_path
end
def show
redirect_to forums_path + "#forums-#{params[:id]}"
end
def edit
if admin?
@group = Forumgroup.find(params[:id])
else
flash[:alert] = "You are not allowed to edit forum groups."
end
end
def update
if admin?
@group = Forumgroup.find(params[:id])
if @group.update_attributes(params[:forumgroup])
flash[:notice] = "Forum group updated"
redirect_to @group
else
flash[:alert] = "Something went wrong"
render :edit
end
else
flash[:alert] = "You are not allowed to change forum groups"
end
end
def new
if admin?
@group = Forumgroup.new
else
flash[:alert] = "You are not allowed to create forum groups."
redirect_to forums_path
end
end
def create
if admin?
@group = Forumgroup.new(params[:forumgroup])
if @group.save
flash[:notice] = "Forum group created."
redirect_to @group
else
flash[:alert] = "Something went wrong"
render :new
end
else
flash[:alert] = "You are not allowed to create forum groups."
redirect_to forums_path
end
end
end