summaryrefslogtreecommitdiff
path: root/app/controllers/groups_controller.rb
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-02-22 07:08:23 -0500
committerPeter Kozak <spag@golwen.net>2013-02-22 07:08:23 -0500
commit2a9b798f9e122582abb36605a7d4a1da0e70eca9 (patch)
tree45fe362d677cb243fba57dc7c0c23d01e653863e /app/controllers/groups_controller.rb
parentd6009d77ffa221c14a4536be98a04e8e4b6474a9 (diff)
pickup group permission model added
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
new file mode 100644
index 0000000..1ab7a4f
--- /dev/null
+++ b/app/controllers/groups_controller.rb
@@ -0,0 +1,49 @@
+class GroupsController < ApplicationController
+ def index
+ @groups = Group.all
+ end
+
+ def show
+ @group = Group.find(params[:id])
+ end
+
+ def new
+ @group = Group.new
+ end
+
+ def create
+ @group = Group.new(params[:group])
+ if @group.save
+ redirect_to @group, :notice => t('groups.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @group = Group.find(params[:id])
+ end
+
+ def update
+ @group = Group.find(params[:id])
+ if @group.update_attributes(params[:group])
+ redirect_to @group, :notice => t('groups.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @group = Group.find(params[:id])
+ @group.destroy
+ redirect_to groups_url, :notice => t('groups.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("groups.index.page_title"), groups_path
+ if @group && !@group.new_record?
+ add_breadcrumb @group, @group
+ end
+ end
+end