Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6eb045fc
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6eb045fc
编写于
6月 11, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent Project.all & User.all in selectboxes
上级
52f312a8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
15 deletion
+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
未找到文件。
app/assets/stylesheets/selects.scss
浏览文件 @
6eb045fc
...
...
@@ -10,6 +10,10 @@
.ajax-users-select
{
width
:
400px
;
&
.input-large
{
width
:
210px
;
}
}
.user-result
{
...
...
app/controllers/admin/projects_controller.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录