summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-08 17:03:30 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-08 17:03:30 -0700
commit9b3e156e43b8a14e4eb294a47bda6a477c8573b0 (patch)
tree4e1de7b6835ac646b34761b5814e4afe250f3f8c /app/controllers/dashboard
parent8b551ee31858db9c5da1ff5245359151d5b71211 (diff)
downloadgitlab-ce-9b3e156e43b8a14e4eb294a47bda6a477c8573b0.tar.gz
Move profile groups page to dashboard
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r--app/controllers/dashboard/groups_controller.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb
new file mode 100644
index 00000000000..61d691e6368
--- /dev/null
+++ b/app/controllers/dashboard/groups_controller.rb
@@ -0,0 +1,21 @@
+class Dashboard::GroupsController < ApplicationController
+ def index
+ @user_groups = current_user.group_members.page(params[:page]).per(20)
+ end
+
+ def leave
+ @users_group = group.group_members.where(user_id: current_user.id).first
+ if can?(current_user, :destroy, @users_group)
+ @users_group.destroy
+ redirect_to(dashboard_groups_path, info: "You left #{group.name} group.")
+ else
+ return render_403
+ end
+ end
+
+ private
+
+ def group
+ @group ||= Group.find_by(path: params[:id])
+ end
+end