BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7e574a89
Commit
7e574a89
authored
Mar 09, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard-groups' into 'master'
Move profile groups page to dashboard For #2069 See merge request !1654
parents
41913fcc
de11c13a
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
43 additions
and
46 deletions
+43
-46
CHANGELOG
CHANGELOG
+1
-0
groups_controller.rb
app/controllers/dashboard/groups_controller.rb
+2
-4
index.html.haml
app/views/dashboard/groups/index.html.haml
+1
-1
_group_member.html.haml
app/views/groups/group_members/_group_member.html.haml
+1
-1
_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+5
-0
_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+0
-5
routes.rb
config/routes.rb
+6
-5
group.feature
features/dashboard/group.feature
+9
-9
group.rb
features/steps/dashboard/group.rb
+1
-1
paths.rb
features/steps/shared/paths.rb
+8
-8
dashboard_access_spec.rb
spec/features/security/dashboard_access_spec.rb
+8
-0
profile_access_spec.rb
spec/features/security/profile_access_spec.rb
+1
-12
No files found.
CHANGELOG
View file @
7e574a89
...
@@ -31,6 +31,7 @@ v 7.9.0 (unreleased)
...
@@ -31,6 +31,7 @@ v 7.9.0 (unreleased)
- Condense commits already in target branch when updating merge request source branch.
- Condense commits already in target branch when updating merge request source branch.
- Send notifications and leave system comments when bulk updating issues.
- Send notifications and leave system comments when bulk updating issues.
- Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison)
- Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison)
- Move groups page from profile to dashboard
v 7.8.2
v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3
- Fix service migration issue when upgrading from versions prior to 7.3
...
...
app/controllers/
profiles
/groups_controller.rb
→
app/controllers/
dashboard
/groups_controller.rb
View file @
7e574a89
class
Profiles
::
GroupsController
<
ApplicationController
class
Dashboard
::
GroupsController
<
ApplicationController
layout
"profile"
def
index
def
index
@user_groups
=
current_user
.
group_members
.
page
(
params
[
:page
]).
per
(
20
)
@user_groups
=
current_user
.
group_members
.
page
(
params
[
:page
]).
per
(
20
)
end
end
...
@@ -9,7 +7,7 @@ class Profiles::GroupsController < ApplicationController
...
@@ -9,7 +7,7 @@ class Profiles::GroupsController < ApplicationController
@users_group
=
group
.
group_members
.
where
(
user_id:
current_user
.
id
).
first
@users_group
=
group
.
group_members
.
where
(
user_id:
current_user
.
id
).
first
if
can?
(
current_user
,
:destroy
,
@users_group
)
if
can?
(
current_user
,
:destroy
,
@users_group
)
@users_group
.
destroy
@users_group
.
destroy
redirect_to
(
profile
_groups_path
,
info:
"You left
#{
group
.
name
}
group."
)
redirect_to
(
dashboard
_groups_path
,
info:
"You left
#{
group
.
name
}
group."
)
else
else
return
render_403
return
render_403
end
end
...
...
app/views/
profiles
/groups/index.html.haml
→
app/views/
dashboard
/groups/index.html.haml
View file @
7e574a89
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
Settings
Settings
-
if
can?
(
current_user
,
:destroy
,
user_group
)
-
if
can?
(
current_user
,
:destroy
,
user_group
)
=
link_to
leave_
profile
_group_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-small btn btn-grouped"
,
title:
'Remove user from group'
do
=
link_to
leave_
dashboard
_group_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-small btn btn-grouped"
,
title:
'Remove user from group'
do
%i
.fa.fa-sign-out
%i
.fa.fa-sign-out
Leave
Leave
...
...
app/views/groups/group_members/_group_member.html.haml
View file @
7e574a89
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
-
if
can?
(
current_user
,
:destroy
,
member
)
-
if
can?
(
current_user
,
:destroy
,
member
)
-
if
current_user
==
member
.
user
-
if
current_user
==
member
.
user
=
link_to
leave_
profile
_group_path
(
@group
),
data:
{
confirm:
leave_group_message
(
@group
.
name
)},
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
=
link_to
leave_
dashboard
_group_path
(
@group
),
data:
{
confirm:
leave_group_message
(
@group
.
name
)},
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
%i
.fa.fa-minus.fa-inverse
%i
.fa.fa-minus.fa-inverse
-
else
-
else
=
link_to
group_group_member_path
(
@group
,
member
),
data:
{
confirm:
remove_user_from_group_message
(
@group
,
user
)
},
method: :delete
,
remote:
true
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
=
link_to
group_group_member_path
(
@group
,
member
),
data:
{
confirm:
remove_user_from_group_message
(
@group
,
user
)
},
method: :delete
,
remote:
true
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
...
...
app/views/layouts/nav/_dashboard.html.haml
View file @
7e574a89
...
@@ -9,6 +9,11 @@
...
@@ -9,6 +9,11 @@
%i
.fa.fa-cube
%i
.fa.fa-cube
%span
%span
Projects
Projects
=
nav_link
(
controller: :groups
)
do
=
link_to
dashboard_groups_path
,
title:
'Groups'
do
%i
.fa.fa-group
%span
Groups
=
nav_link
(
controller: :milestones
)
do
=
nav_link
(
controller: :milestones
)
do
=
link_to
dashboard_milestones_path
,
title:
'Milestones'
do
=
link_to
dashboard_milestones_path
,
title:
'Milestones'
do
%i
.fa.fa-clock-o
%i
.fa.fa-clock-o
...
...
app/views/layouts/nav/_profile.html.haml
View file @
7e574a89
...
@@ -43,11 +43,6 @@
...
@@ -43,11 +43,6 @@
%i
.fa.fa-image
%i
.fa.fa-image
%span
%span
Design
Design
=
nav_link
(
controller: :groups
)
do
=
link_to
profile_groups_path
,
title:
'Groups'
do
%i
.fa.fa-group
%span
Groups
=
nav_link
(
path:
'profiles#history'
)
do
=
nav_link
(
path:
'profiles#history'
)
do
=
link_to
history_profile_path
,
title:
'History'
do
=
link_to
history_profile_path
,
title:
'History'
do
%i
.fa.fa-history
%i
.fa.fa-history
...
...
config/routes.rb
View file @
7e574a89
...
@@ -193,11 +193,6 @@ Gitlab::Application.routes.draw do
...
@@ -193,11 +193,6 @@ Gitlab::Application.routes.draw do
end
end
resources
:keys
resources
:keys
resources
:emails
,
only:
[
:index
,
:create
,
:destroy
]
resources
:emails
,
only:
[
:index
,
:create
,
:destroy
]
resources
:groups
,
only:
[
:index
]
do
member
do
delete
:leave
end
end
resource
:avatar
,
only:
[
:destroy
]
resource
:avatar
,
only:
[
:destroy
]
end
end
end
end
...
@@ -220,6 +215,12 @@ Gitlab::Application.routes.draw do
...
@@ -220,6 +215,12 @@ Gitlab::Application.routes.draw do
scope
module: :dashboard
do
scope
module: :dashboard
do
resources
:milestones
,
only:
[
:index
,
:show
]
resources
:milestones
,
only:
[
:index
,
:show
]
resources
:groups
,
only:
[
:index
]
do
member
do
delete
:leave
end
end
end
end
end
end
...
...
features/
profile
/group.feature
→
features/
dashboard
/group.feature
View file @
7e574a89
@
profile
@
dashboard
Feature
:
Profile
Group
Feature
:
Dashboard
Group
Background
:
Background
:
Given
I sign in as
"John Doe"
Given
I sign in as
"John Doe"
And
"John
Doe"
is
owner
of
group
"Owned"
And
"John
Doe"
is
owner
of
group
"Owned"
...
@@ -10,18 +10,18 @@ Feature: Profile Group
...
@@ -10,18 +10,18 @@ Feature: Profile Group
@javascript
@javascript
Scenario
:
Owner should be able to leave from group if he is not the last owner
Scenario
:
Owner should be able to leave from group if he is not the last owner
Given "Mary Jane" is owner of group "Owned"
Given "Mary Jane" is owner of group "Owned"
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should see group
"Guest"
in group list
Then
I should see group
"Guest"
in group list
When
I click on the
"Leave"
button for group
"Owned"
When
I click on the
"Leave"
button for group
"Owned"
And
I visit
profile
groups page
And
I visit
dashboard
groups page
Then
I should not see group
"Owned"
in group list
Then
I should not see group
"Owned"
in group list
Then
I should see group
"Guest"
in group list
Then
I should see group
"Guest"
in group list
@javascript
@javascript
Scenario
:
Owner should not be able to leave from group if he is the last owner
Scenario
:
Owner should not be able to leave from group if he is the last owner
Given "Mary Jane" is guest of group "Owned"
Given "Mary Jane" is guest of group "Owned"
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should see group
"Guest"
in group list
Then
I should see group
"Guest"
in group list
Then
I should not see the
"Leave"
button for group
"Owned"
Then
I should not see the
"Leave"
button for group
"Owned"
...
@@ -29,20 +29,20 @@ Feature: Profile Group
...
@@ -29,20 +29,20 @@ Feature: Profile Group
@javascript
@javascript
Scenario
:
Guest should be able to leave from group
Scenario
:
Guest should be able to leave from group
Given "Mary Jane" is guest of group "Guest"
Given "Mary Jane" is guest of group "Guest"
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should see group
"Guest"
in group list
Then
I should see group
"Guest"
in group list
When
I click on the
"Leave"
button for group
"Guest"
When
I click on the
"Leave"
button for group
"Guest"
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should not see group
"Guest"
in group list
Then
I should not see group
"Guest"
in group list
@javascript
@javascript
Scenario
:
Guest should be able to leave from group even if he is the only user in the group
Scenario
:
Guest should be able to leave from group even if he is the only user in the group
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should see group
"Guest"
in group list
Then
I should see group
"Guest"
in group list
When
I click on the
"Leave"
button for group
"Guest"
When
I click on the
"Leave"
button for group
"Guest"
When
I visit
profile
groups page
When
I visit
dashboard
groups page
Then
I should see group
"Owned"
in group list
Then
I should see group
"Owned"
in group list
Then
I should not see group
"Guest"
in group list
Then
I should not see group
"Guest"
in group list
features/steps/
profile
/group.rb
→
features/steps/
dashboard
/group.rb
View file @
7e574a89
class
Spinach
::
Features
::
Profile
Group
<
Spinach
::
FeatureSteps
class
Spinach
::
Features
::
Dashboard
Group
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedAuthentication
include
SharedGroup
include
SharedGroup
include
SharedPaths
include
SharedPaths
...
...
features/steps/shared/paths.rb
View file @
7e574a89
...
@@ -87,6 +87,14 @@ module SharedPaths
...
@@ -87,6 +87,14 @@ module SharedPaths
visit
help_path
visit
help_path
end
end
step
'I visit dashboard groups page'
do
visit
dashboard_groups_path
end
step
'I should be redirected to the dashboard groups page'
do
current_path
.
should
==
dashboard_groups_path
end
# ----------------------------------------
# ----------------------------------------
# Profile
# Profile
# ----------------------------------------
# ----------------------------------------
...
@@ -119,14 +127,6 @@ module SharedPaths
...
@@ -119,14 +127,6 @@ module SharedPaths
visit
history_profile_path
visit
history_profile_path
end
end
step
'I visit profile groups page'
do
visit
profile_groups_path
end
step
'I should be redirected to the profile groups page'
do
current_path
.
should
==
profile_groups_path
end
# ----------------------------------------
# ----------------------------------------
# Admin
# Admin
# ----------------------------------------
# ----------------------------------------
...
...
spec/features/security/dashboard_access_spec.rb
View file @
7e574a89
...
@@ -52,4 +52,12 @@ describe "Dashboard access", feature: true do
...
@@ -52,4 +52,12 @@ describe "Dashboard access", feature: true do
it
{
expect
(
new_group_path
).
to
be_allowed_for
:user
}
it
{
expect
(
new_group_path
).
to
be_allowed_for
:user
}
it
{
expect
(
new_group_path
).
to
be_denied_for
:visitor
}
it
{
expect
(
new_group_path
).
to
be_denied_for
:visitor
}
end
end
describe
"GET /profile/groups"
do
subject
{
dashboard_groups_path
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
end
spec/features/security/profile_access_spec.rb
View file @
7e574a89
require
'spec_helper'
require
'spec_helper'
describe
"Users Security"
,
feature:
true
do
describe
"Profile access"
,
feature:
true
do
describe
"Project"
do
before
do
before
do
@u1
=
create
(
:user
)
@u1
=
create
(
:user
)
end
end
...
@@ -63,14 +62,4 @@ describe "Users Security", feature: true do
...
@@ -63,14 +62,4 @@ describe "Users Security", feature: true do
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
describe
"GET /profile/groups"
do
subject
{
profile_groups_path
}
it
{
is_expected
.
to
be_allowed_for
@u1
}
it
{
is_expected
.
to
be_allowed_for
:admin
}
it
{
is_expected
.
to
be_allowed_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
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