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
6eb045fc
Commit
6eb045fc
authored
Jun 11, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent Project.all & User.all in selectboxes
parent
52f312a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
app/assets/stylesheets/selects.scss
app/assets/stylesheets/selects.scss
+4
-0
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+4
-2
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-3
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+2
-8
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+2
-2
No files found.
app/assets/stylesheets/selects.scss
View file @
6eb045fc
...
...
@@ -10,6 +10,10 @@
.ajax-users-select
{
width
:
400px
;
&
.input-large
{
width
:
210px
;
}
}
.user-result
{
...
...
app/controllers/admin/projects_controller.rb
View file @
6eb045fc
...
...
@@ -2,8 +2,10 @@ class Admin::ProjectsController < Admin::ApplicationController
before_filter
:project
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:team_update
]
def
index
@projects
=
Project
.
scoped
@projects
=
@projects
.
where
(
namespace_id:
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
owner_id
=
params
[
:owner_id
]
user
=
User
.
find_by_id
(
owner_id
)
@projects
=
user
?
user
.
owned_projects
:
Project
.
scoped
@projects
=
@projects
.
where
(
public:
true
)
if
params
[
:public_only
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
...
...
app/helpers/application_helper.rb
View file @
6eb045fc
...
...
@@ -192,9 +192,12 @@ module ApplicationHelper
alias_method
:url_to_image
,
:image_url
def
users_select_tag
(
id
,
opts
=
{})
css_class
=
"ajax-users-select"
css_class
<<
" multiselect"
if
opts
[
:multiple
]
hidden_field_tag
(
id
,
''
,
class:
css_class
)
css_class
=
"ajax-users-select "
css_class
<<
"multiselect "
if
opts
[
:multiple
]
css_class
<<
opts
[
:class
]
||
''
value
=
opts
[
:selected
]
||
''
hidden_field_tag
(
id
,
value
,
class:
css_class
)
end
def
body_data_page
...
...
app/helpers/namespaces_helper.rb
View file @
6eb045fc
module
NamespacesHelper
def
namespaces_options
(
selected
=
:current_user
,
scope
=
:default
)
if
current_user
.
admin
groups
=
Group
.
all
users
=
Namespace
.
root
else
groups
=
current_user
.
owned_groups
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
end
groups
=
current_user
.
owned_groups
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
global_opts
=
[
"Global"
,
[[
'/'
,
Namespace
.
global_id
]]
]
group_opts
=
[
"Groups"
,
groups
.
sort_by
(
&
:human_name
).
map
{
|
g
|
[
g
.
human_name
,
g
.
id
]}
]
...
...
app/views/admin/projects/index.html.haml
View file @
6eb045fc
...
...
@@ -14,9 +14,9 @@
=
text_field_tag
:name
,
params
[
:name
],
class:
"span2"
.control-group
=
label_tag
:
namespace_id
,
'Namespace
:'
,
class:
'control-label'
=
label_tag
:
owner_id
,
'Owner
:'
,
class:
'control-label'
.controls
=
select_tag
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
],
:all
),
class:
"chosen span2"
,
prompt:
"Any"
=
users_select_tag
:owner_id
,
selected:
params
[
:owner_id
],
class:
'input-large'
.control-group
=
label_tag
:public_only
,
'Public Only'
,
class:
'control-label'
.controls
...
...
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