LOTS of stuff

This commit is contained in:
jomo
2014-04-04 01:08:17 +02:00
parent 0604bbce63
commit f290258f26
62 changed files with 1457 additions and 655 deletions

View File

@@ -9,17 +9,33 @@ class ForumgroupsController < ApplicationController
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 forums."
flash[:alert] = "You are not allowed to create forum groups."
redirect_to forums_path
end
end
@@ -28,14 +44,14 @@ class ForumgroupsController < ApplicationController
if admin?
@group = Forumgroup.new(params[:forumgroup])
if @group.save
flash[:notice] = "Forums created."
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 forums."
flash[:alert] = "You are not allowed to create forum groups."
redirect_to forums_path
end
end