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
Boxiang Sun
gitlab-ce
Commits
7034ef29
Commit
7034ef29
authored
Jan 09, 2018
by
Mark Fletcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide new branch and tag links for projects with an empty repo
parent
396e7647
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
6 deletions
+51
-6
app/views/projects/buttons/_dropdown.html.haml
app/views/projects/buttons/_dropdown.html.haml
+7
-6
changelogs/unreleased/39988-hide-new-branch-tag-empty-repo.yml
...elogs/unreleased/39988-hide-new-branch-tag-empty-repo.yml
+5
-0
spec/views/projects/buttons/_dropdown.html.haml_spec.rb
spec/views/projects/buttons/_dropdown.html.haml_spec.rb
+39
-0
No files found.
app/views/projects/buttons/_dropdown.html.haml
View file @
7034ef29
...
...
@@ -30,6 +30,7 @@
%li
=
link_to
project_new_blob_path
(
@project
,
@project
.
default_branch
||
'master'
)
do
#{
_
(
'New file'
)
}
-
unless
@project
.
empty_repo?
%li
=
link_to
new_project_branch_path
(
@project
)
do
#{
_
(
'New branch'
)
}
...
...
changelogs/unreleased/39988-hide-new-branch-tag-empty-repo.yml
0 → 100644
View file @
7034ef29
---
title
:
Hide new branch and tag links for projects with an empty repo
merge_request
:
author
:
type
:
fixed
spec/views/projects/buttons/_dropdown.html.haml_spec.rb
0 → 100644
View file @
7034ef29
require
'spec_helper'
describe
'projects/buttons/_dropdown'
do
let
(
:user
)
{
create
(
:user
)
}
context
'user with all abilities'
do
before
do
assign
(
:project
,
project
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
view
).
to
receive
(
:can?
).
and_return
(
true
)
end
context
'empty repository'
do
let
(
:project
)
{
create
(
:project
,
:empty_repo
)
}
it
'has a link to create a new file'
do
render
expect
(
view
).
to
render_template
(
'projects/buttons/_dropdown'
)
expect
(
rendered
).
to
have_link
(
'New file'
)
end
it
'does not have a link to create a new branch'
do
render
expect
(
view
).
to
render_template
(
'projects/buttons/_dropdown'
)
expect
(
rendered
).
not_to
have_link
(
'New branch'
)
end
it
'does not have a link to create a new tag'
do
render
expect
(
view
).
to
render_template
(
'projects/buttons/_dropdown'
)
expect
(
rendered
).
not_to
have_link
(
'New tag'
)
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