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
Tatuya Kamada
gitlab-ce
Commits
74c8a635
Commit
74c8a635
authored
Jun 13, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move project nav checks to helper
parent
313ac555
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
17 deletions
+54
-17
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+32
-0
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+22
-17
No files found.
app/helpers/projects_helper.rb
View file @
74c8a635
...
...
@@ -48,4 +48,36 @@ module ProjectsHelper
def
remove_project_message
(
project
)
"You are going to remove
#{
project
.
name_with_namespace
}
.
\n
Removed project CANNOT be restored!
\n
Are you ABSOLUTELY sure?"
end
def
project_nav_tabs
@nav_tabs
||=
get_project_nav_tabs
(
@project
,
current_user
)
end
def
project_nav_tab?
(
name
)
project_nav_tabs
.
include?
name
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
nav_tabs
=
[
:home
]
if
project
.
repo_exists?
&&
can?
(
current_user
,
:download_code
,
project
)
nav_tabs
<<
[
:files
,
:commits
,
:network
,
:graphs
]
end
if
project
.
repo_exists?
&&
project
.
merge_requests_enabled
nav_tabs
<<
:merge_requests
end
if
can?
(
current_user
,
:admin_project
,
project
)
nav_tabs
<<
:settings
end
[
:issues
,
:wiki
,
:wall
,
:snippets
].
each
do
|
feature
|
nav_tabs
<<
feature
if
project
.
send
:"
#{
feature
}
_enabled"
end
nav_tabs
.
flatten
end
end
app/views/layouts/nav/_project.html.haml
View file @
74c8a635
...
...
@@ -3,43 +3,48 @@
=
link_to
project_path
(
@project
),
title:
"Project"
do
%i
.icon-home
-
unless
@project
.
empty_repo?
-
if
can?
current_user
,
:download_code
,
@project
=
nav_link
(
controller:
%w(tree blob blame)
)
do
=
link_to
'Files'
,
project_tree_path
(
@project
,
@ref
||
@repository
.
root_ref
)
=
nav_link
(
controller:
%w(commit commits compare repositories protected_branches)
)
do
=
link_to
"Commits"
,
project_commits_path
(
@project
,
@ref
||
@repository
.
root_ref
)
=
nav_link
(
controller:
%w(network)
)
do
=
link_to
"Network"
,
project_network_path
(
@project
,
@ref
||
@repository
.
root_ref
)
=
nav_link
(
controller:
%w(graphs)
)
do
=
link_to
"Graphs"
,
project_graph_path
(
@project
,
@ref
||
@repository
.
root_ref
)
-
if
@project
.
issues_enabled
-
if
project_nav_tab?
:files
=
nav_link
(
controller:
%w(tree blob blame)
)
do
=
link_to
'Files'
,
project_tree_path
(
@project
,
@ref
||
@repository
.
root_ref
)
-
if
project_nav_tab?
:commits
=
nav_link
(
controller:
%w(commit commits compare repositories protected_branches)
)
do
=
link_to
"Commits"
,
project_commits_path
(
@project
,
@ref
||
@repository
.
root_ref
)
-
if
project_nav_tab?
:network
=
nav_link
(
controller:
%w(network)
)
do
=
link_to
"Network"
,
project_network_path
(
@project
,
@ref
||
@repository
.
root_ref
)
-
if
project_nav_tab?
:graphs
=
nav_link
(
controller:
%w(graphs)
)
do
=
link_to
"Graphs"
,
project_graph_path
(
@project
,
@ref
||
@repository
.
root_ref
)
-
if
project_nav_tab?
:issues
=
nav_link
(
controller:
%w(issues milestones labels)
)
do
=
link_to
url_for_project_issues
do
Issues
-
if
@project
.
used_default_issues_tracker?
%span
.count.issue_counter
=
@project
.
issues
.
opened
.
count
-
if
@project
.
repo_exists?
&&
@project
.
merge_requests_enabled
-
if
project_nav_tab?
:merge_requests
=
nav_link
(
controller: :merge_requests
)
do
=
link_to
project_merge_requests_path
(
@project
)
do
Merge Requests
%span
.count.merge_counter
=
@project
.
merge_requests
.
opened
.
count
-
if
@project
.
wiki_enabled
-
if
project_nav_tab?
:wiki
=
nav_link
(
controller: :wikis
)
do
=
link_to
'Wiki'
,
project_wiki_path
(
@project
,
:home
)
-
if
@project
.
wall_enabled
-
if
project_nav_tab?
:wall
=
nav_link
(
controller: :walls
)
do
=
link_to
'Wall'
,
project_wall_path
(
@project
)
-
if
@project
.
snippets_enabled
-
if
project_nav_tab?
:snippets
=
nav_link
(
controller: :snippets
)
do
=
link_to
'Snippets'
,
project_snippets_path
(
@project
)
-
if
can?
current_user
,
:admin_project
,
@project
-
if
project_nav_tab?
:settings
=
nav_link
(
html_options:
{
class:
"
#{
project_tab_class
}
"
})
do
=
link_to
edit_project_path
(
@project
),
class:
"stat-tab tab "
do
Settings
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