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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
66a8281f
Commit
66a8281f
authored
Dec 21, 2015
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and test leave project display
parent
f4c05ee4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
9 deletions
+33
-9
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+8
-8
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-1
spec/features/projects_spec.rb
spec/features/projects_spec.rb
+14
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+10
-0
No files found.
app/helpers/projects_helper.rb
View file @
66a8281f
...
...
@@ -105,6 +105,14 @@ module ProjectsHelper
end
end
def
user_max_access_in_project
(
user_id
,
project
)
level
=
project
.
team
.
max_member_access
(
user_id
)
if
level
Gitlab
::
Access
.
options_with_owner
.
key
(
level
)
end
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
@@ -277,14 +285,6 @@ module ProjectsHelper
end
end
def
user_max_access_in_project
(
user
,
project
)
level
=
project
.
team
.
max_member_access
(
user
)
if
level
Gitlab
::
Access
.
options_with_owner
.
key
(
level
)
end
end
def
leave_project_message
(
project
)
"Are you sure you want to leave
\"
#{
project
.
name
}
\"
project?"
end
...
...
app/views/projects/show.html.haml
View file @
66a8281f
...
...
@@ -71,7 +71,7 @@
=
render
default_project_view
-
if
current_user
-
access
=
user_max_access_in_project
(
current_user
,
@project
)
-
access
=
user_max_access_in_project
(
current_user
.
id
,
@project
)
-
if
access
.prepend-top-20.project-footer
.gray-content-block.footer-block.center
...
...
spec/features/projects_spec.rb
View file @
66a8281f
...
...
@@ -70,6 +70,20 @@ feature 'Project', feature: true do
end
end
describe
'leave project link'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
login_with
(
user
)
project
.
team
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
visit
namespace_project_path
(
project
.
namespace
,
project
)
end
it
{
expect
(
page
).
to
have_content
(
'You have Master access to this project.'
)
}
it
{
expect
(
page
).
to
have_link
(
'Leave this project'
)
}
end
def
remove_with_confirm
(
button_text
,
confirm_with
)
click_button
button_text
fill_in
'confirm_name_input'
,
with:
confirm_with
...
...
spec/helpers/projects_helper_spec.rb
View file @
66a8281f
...
...
@@ -53,6 +53,16 @@ describe ProjectsHelper do
end
end
describe
'user_max_access_in_project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
team
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
end
it
{
expect
(
helper
.
user_max_access_in_project
(
user
.
id
,
project
)).
to
eq
(
'Master'
)
}
end
describe
"readme_cache_key"
do
let
(
:project
)
{
create
(
:project
)
}
...
...
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