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
a487c951
Commit
a487c951
authored
Jun 30, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper for rendering link to protected features
parent
54881838
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
18 deletions
+27
-18
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+13
-0
app/views/projects/commits/_head.html.haml
app/views/projects/commits/_head.html.haml
+3
-4
app/views/projects/graphs/_head.html.haml
app/views/projects/graphs/_head.html.haml
+3
-4
app/views/projects/pipelines/_head.html.haml
app/views/projects/pipelines/_head.html.haml
+4
-5
app/views/projects/settings/_head.html.haml
app/views/projects/settings/_head.html.haml
+4
-5
No files found.
app/helpers/tab_helper.rb
View file @
a487c951
...
...
@@ -89,6 +89,19 @@ module TabHelper
end
end
def
link_to_protected_feature
(
url
,
*
args
,
&
block
)
link_text
=
capture
(
&
block
)
options
=
args
.
extract_options!
feature_key
=
options
.
delete
(
:feature
)
user
=
options
.
delete
(
:user
)
if
@project
.
feature_available?
(
feature_key
,
user
)
link_to
(
link_text
,
url
,
options
)
else
link_to
(
link_text
,
'#'
,
options
)
end
end
def
current_path?
(
path
)
c
,
a
,
_
=
path
.
split
(
'#'
)
current_controller?
(
c
)
&&
current_action?
(
a
)
...
...
app/views/projects/commits/_head.html.haml
View file @
a487c951
...
...
@@ -35,7 +35,6 @@
=
link_to
charts_namespace_project_graph_path
(
@project
.
namespace
,
@project
,
current_ref
)
do
#{
_
(
'Charts'
)
}
-
if
@project
.
feature_available?
(
:file_lock
)
=
nav_link
(
controller:
[
:path_locks
])
do
=
link_to
namespace_project_path_locks_path
(
@project
.
namespace
,
@project
)
do
Locked Files
=
nav_link
(
controller:
[
:path_locks
])
do
=
link_to_protected_feature
namespace_project_path_locks_path
(
@project
.
namespace
,
@project
),
feature: :file_lock
do
Locked Files
app/views/projects/graphs/_head.html.haml
View file @
a487c951
...
...
@@ -13,7 +13,6 @@
=
link_to
'Commits'
,
commits_namespace_project_graph_path
=
nav_link
(
action: :languages
)
do
=
link_to
'Languages'
,
languages_namespace_project_graph_path
-
if
@project
.
feature_available?
(
:builds
,
current_user
)
=
nav_link
(
action: :ci
)
do
=
link_to
ci_namespace_project_graph_path
do
Continuous Integration
=
nav_link
(
action: :ci
)
do
=
link_to_protected_feature
ci_namespace_project_graph_path
,
feature: :builds
,
user:
current_user
do
Continuous Integration
app/views/projects/pipelines/_head.html.haml
View file @
a487c951
...
...
@@ -27,8 +27,7 @@
%span
Environments
-
if
@project
.
feature_available?
(
:builds
,
current_user
)
&&
!
@project
.
empty_repo?
=
nav_link
(
path:
'pipelines#charts'
)
do
=
link_to
charts_namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
title:
'Charts'
,
class:
'shortcuts-pipelines-charts'
do
%span
Charts
=
nav_link
(
path:
'pipelines#charts'
)
do
=
link_to_protected_feature
charts_namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
feature: :builds
,
user:
current_user
,
title:
'Charts'
,
class:
'shortcuts-pipelines-charts'
do
%span
Charts
app/views/projects/settings/_head.html.haml
View file @
a487c951
...
...
@@ -22,11 +22,10 @@
=
link_to
namespace_project_settings_repository_path
(
@project
.
namespace
,
@project
),
title:
'Repository'
do
%span
Repository
-
if
@project
.
feature_available?
(
:builds
,
current_user
)
=
nav_link
(
controller: :ci_cd
)
do
=
link_to
namespace_project_settings_ci_cd_path
(
@project
.
namespace
,
@project
),
title:
'Pipelines'
do
%span
Pipelines
=
nav_link
(
controller: :ci_cd
)
do
=
link_to_protected_feature
namespace_project_settings_ci_cd_path
(
@project
.
namespace
,
@project
),
feature: :builds
,
user:
current_user
,
title:
'Pipelines'
do
%span
Pipelines
-
if
Gitlab
.
config
.
pages
.
enabled
=
nav_link
(
controller: :pages
)
do
=
link_to
namespace_project_pages_path
(
@project
.
namespace
,
@project
),
title:
'Pages'
do
...
...
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