Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
acb402a1
Commit
acb402a1
authored
Jul 12, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ability to leave group from profile area
parent
7a42dece
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
2 deletions
+56
-2
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+5
-0
app/controllers/profiles/groups_controller.rb
app/controllers/profiles/groups_controller.rb
+24
-0
app/views/layouts/_flash.html.haml
app/views/layouts/_flash.html.haml
+1
-1
app/views/layouts/nav/_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+2
-0
app/views/profiles/groups/index.html.haml
app/views/profiles/groups/index.html.haml
+17
-0
app/views/users_groups/_users_group.html.haml
app/views/users_groups/_users_group.html.haml
+2
-1
config/routes.rb
config/routes.rb
+5
-0
No files found.
app/assets/stylesheets/common.scss
View file @
acb402a1
...
...
@@ -420,3 +420,8 @@ img.emoji {
@extend
.light
;
margin-bottom
:
10px
;
}
.group-name
{
font-size
:
14px
;
line-height
:
24px
;
}
app/controllers/profiles/groups_controller.rb
0 → 100644
View file @
acb402a1
class
Profiles::GroupsController
<
ApplicationController
layout
"profile"
def
index
@groups
=
current_user
.
authorized_groups
.
all
end
def
leave
@users_group
=
group
.
users_groups
.
where
(
user_id:
current_user
.
id
).
first
if
group
.
owner
==
current_user
redirect_to
(
profile_groups_path
,
alert:
"You can't leave group. You must transfer it to another owner before leaving."
)
else
@users_group
.
destroy
redirect_to
(
profile_groups_path
,
info:
"You left
#{
group
.
name
}
group."
)
end
end
private
def
group
@group
||=
Group
.
find_by_path
(
params
[
:id
])
end
end
app/views/layouts/_flash.html.haml
View file @
acb402a1
.flash-container
-
if
alert
.alert
.alert
.alert-error
%span
=
alert
-
elsif
notice
...
...
app/views/layouts/nav/_profile.html.haml
View file @
acb402a1
...
...
@@ -12,6 +12,8 @@
%span
.count
=
current_user
.
keys
.
count
=
nav_link
(
path:
'profiles#design'
)
do
=
link_to
"Design"
,
design_profile_path
=
nav_link
(
controller: :groups
)
do
=
link_to
"Groups"
,
profile_groups_path
=
nav_link
(
path:
'profiles#history'
)
do
=
link_to
"History"
,
history_profile_path
app/views/profiles/groups/index.html.haml
0 → 100644
View file @
acb402a1
.ui-box
%h5
.title
Groups
%ul
.well-list
-
@groups
.
each
do
|
group
|
%li
.pull-right
-
if
can?
(
current_user
,
:manage_group
,
group
)
=
link_to
edit_group_path
(
group
),
class:
"btn-small btn grouped"
do
%i
.icon-cogs
Settings
=
link_to
leave_profile_group_path
(
group
),
confirm:
"Are you sure you want to leave
#{
group
.
name
}
group?"
,
method: :delete
,
class:
"btn-small btn grouped"
,
title:
'Remove user from group'
do
%i
.icon-signout
Leave
=
link_to
group
,
class:
'group-name'
do
=
group
.
name
app/views/users_groups/_users_group.html.haml
View file @
acb402a1
...
...
@@ -13,6 +13,7 @@
-
else
=
member
.
human_access
-
if
show_controls
&&
user
!=
current_user
&&
user
!=
@group
.
own
er
-
if
show_controls
&&
user
!=
@group
.
owner
&&
user
!=
current_us
er
=
link_to
group_users_group_path
(
@group
,
member
),
confirm:
remove_user_from_group_message
(
@group
,
user
),
method: :delete
,
remote:
true
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
%i
.icon-minus.icon-white
config/routes.rb
View file @
acb402a1
...
...
@@ -116,6 +116,11 @@ Gitlab::Application.routes.draw do
resource
:notifications
,
only:
[
:show
,
:update
]
resource
:password
,
only:
[
:new
,
:create
]
resources
:keys
resources
:groups
,
only:
[
:index
]
do
member
do
delete
:leave
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment