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
Léo-Paul Géneau
gitlab-ce
Commits
81f8114f
Commit
81f8114f
authored
Nov 27, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NamespacesHelper
parent
039996bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-22
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+26
-0
No files found.
app/helpers/application_helper.rb
View file @
81f8114f
...
...
@@ -74,28 +74,6 @@ module ApplicationHelper
grouped_options_for_select
(
options
,
@ref
||
@project
.
default_branch
)
end
def
namespaces_options
(
selected
=
:current_user
,
scope
=
:default
)
groups
=
current_user
.
namespaces
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
if
scope
==
:all
Namespace
.
root
else
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
end
options
=
[
[
"Global"
,
[[
'/'
,
Namespace
.
global_id
]]
],
[
"Groups"
,
groups
.
map
{
|
g
|
[
g
.
human_name
,
g
.
id
]}
],
[
"Users"
,
users
.
map
{
|
u
|
[
u
.
human_name
,
u
.
id
]}
]
]
if
selected
==
:current_user
&&
current_user
.
namespace
selected
=
current_user
.
namespace
.
id
end
grouped_options_for_select
(
options
,
selected
)
end
def
search_autocomplete_source
projects
=
current_user
.
projects
.
map
{
|
p
|
{
label:
p
.
name_with_namespace
,
url:
project_path
(
p
)
}
}
...
...
app/helpers/namespaces_helper.rb
0 → 100644
View file @
81f8114f
module
NamespacesHelper
def
namespaces_options
(
selected
=
:current_user
,
scope
=
:default
)
groups
=
current_user
.
namespaces
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
if
scope
==
:all
Namespace
.
root
else
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
end
global_opts
=
[
"Global"
,
[[
'/'
,
Namespace
.
global_id
]]
]
group_opts
=
[
"Groups"
,
groups
.
map
{
|
g
|
[
g
.
human_name
,
g
.
id
]}
]
users_opts
=
[
"Users"
,
users
.
map
{
|
u
|
[
u
.
human_name
,
u
.
id
]}
]
options
=
[]
options
<<
global_opts
if
current_user
.
admin
options
<<
group_opts
options
<<
users_opts
if
selected
==
:current_user
&&
current_user
.
namespace
selected
=
current_user
.
namespace
.
id
end
grouped_options_for_select
(
options
,
selected
)
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