diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-27 12:22:29 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-27 12:22:29 +0100 |
commit | 67c1a0a951403a546250ea860a3e3d199cae2fce (patch) | |
tree | f86ec6cedf081a1a57005eca1661e9bead34e4de /app/controllers/groups_controller.rb | |
parent | 5d8ce5f4775ac8bc5f523964e6e36f63ff3c4683 (diff) | |
parent | 211f558a86ae30cdd5b392ab1376e1393f97e22c (diff) |
Merge branch 'develop'5.1-beta6
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r-- | app/controllers/groups_controller.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb new file mode 100644 index 0000000..74ad7c8 --- /dev/null +++ b/app/controllers/groups_controller.rb @@ -0,0 +1,52 @@ +class GroupsController < ApplicationController + load_and_authorize_resource :group + before_filter :spread_breadcrumbs + + 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 |