Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0ccdb41c
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,发现更多精彩内容 >>
未验证
提交
0ccdb41c
编写于
8月 30, 2016
作者:
L
Luke Bennett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Review changes, simplified dropdown init
上级
bd595eb8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
44 deletion
+13
-44
app/assets/javascripts/todos.js
app/assets/javascripts/todos.js
+10
-41
app/views/dashboard/todos/index.html.haml
app/views/dashboard/todos/index.html.haml
+3
-3
未找到文件。
app/assets/javascripts/todos.js
浏览文件 @
0ccdb41c
...
...
@@ -30,9 +30,9 @@
Todos
.
prototype
.
initFilters
=
function
()
{
new
UsersSelect
();
this
.
init
ProjectFilterDropdown
(
);
this
.
init
TypeFilterDropdown
(
);
this
.
init
ActionFilterDropdown
(
);
this
.
init
FilterDropdown
(
$
(
'
.js-project-search
'
),
'
project_id
'
,
true
);
this
.
init
FilterDropdown
(
$
(
'
.js-type-search
'
),
'
type
'
);
this
.
init
FilterDropdown
(
$
(
'
.js-action-search
'
),
'
action_id
'
);
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
event
.
preventDefault
();
...
...
@@ -40,47 +40,16 @@
});
};
Todos
.
prototype
.
initProjectFilterDropdown
=
function
()
{
$projectDropdown
=
$
(
'
.js-project-search
'
);
$projectDropdown
.
glDropdown
({
filterable
:
true
,
Todos
.
prototype
.
initFilterDropdown
=
function
(
$dropdown
,
fieldName
,
isFilterable
)
{
$dropdown
.
glDropdown
({
selectable
:
true
,
fieldName
:
'
project_id
'
,
data
:
$projectDropdown
.
data
(
'
data
'
),
filterable
:
isFilterable
,
fieldName
:
fieldName
,
data
:
$dropdown
.
data
(
'
data
'
),
clicked
:
function
()
{
if
(
$projectDropdown
.
hasClass
(
'
js-filter-submit
'
))
{
return
$projectDropdown
.
closest
(
'
form.filter-form
'
).
submit
();
}
return
$dropdown
.
closest
(
'
form.filter-form
'
).
submit
();
}
});
};
Todos
.
prototype
.
initTypeFilterDropdown
=
function
()
{
$typeDropdown
=
$
(
'
.js-type-search
'
);
$typeDropdown
.
glDropdown
({
selectable
:
true
,
fieldName
:
'
type
'
,
data
:
$typeDropdown
.
data
(
'
data
'
),
clicked
:
function
()
{
if
(
$typeDropdown
.
hasClass
(
'
js-filter-submit
'
))
{
return
$typeDropdown
.
closest
(
'
form.filter-form
'
).
submit
();
}
}
});
};
Todos
.
prototype
.
initActionFilterDropdown
=
function
()
{
$actionDropdown
=
$
(
'
.js-action-search
'
);
$actionDropdown
.
glDropdown
({
selectable
:
true
,
fieldName
:
'
action_id
'
,
data
:
$actionDropdown
.
data
(
'
data
'
),
clicked
:
function
()
{
if
(
$actionDropdown
.
hasClass
(
'
js-filter-submit
'
))
{
return
$actionDropdown
.
closest
(
'
form.filter-form
'
).
submit
();
}
}
});
})
};
Todos
.
prototype
.
doneClicked
=
function
(
e
)
{
...
...
app/views/dashboard/todos/index.html.haml
浏览文件 @
0ccdb41c
...
...
@@ -30,12 +30,12 @@
.filter-item.inline
-
if
params
[
:project_id
].
present?
=
hidden_field_tag
(
:project_id
,
params
[
:project_id
])
=
dropdown_tag
(
project_dropdown_label
(
params
[
:project_id
],
'Project'
),
options:
{
toggle_class:
'js-project-search js-filter-submit'
,
title:
'Filter by project'
,
filter:
true
,
filterInput:
'input#search'
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-project js-filter-submit'
,
placeholder:
'Search projects'
,
data:
{
data:
todo_projects_options
,
selected:
params
[
:project_id
],
field_name:
'project_id'
,
default_label:
'Project'
}
})
=
dropdown_tag
(
project_dropdown_label
(
params
[
:project_id
],
'Project'
),
options:
{
toggle_class:
'js-project-search js-filter-submit'
,
title:
'Filter by project'
,
filter:
true
,
filterInput:
'input#
project-
search'
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-project js-filter-submit'
,
placeholder:
'Search projects'
,
data:
{
data:
todo_projects_options
}
})
.filter-item.inline
-
if
params
[
:author_id
].
present?
=
hidden_field_tag
(
:author_id
,
params
[
:author_id
])
=
dropdown_tag
(
user_dropdown_label
(
params
[
:author_id
],
'Author'
),
options:
{
toggle_class:
'js-user-search js-filter-submit js-author-search'
,
title:
'Filter by author'
,
filter:
true
,
filterInput:
'input#search'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit'
,
=
dropdown_tag
(
user_dropdown_label
(
params
[
:author_id
],
'Author'
),
options:
{
toggle_class:
'js-user-search js-filter-submit js-author-search'
,
title:
'Filter by author'
,
filter:
true
,
filterInput:
'input#
author-
search'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit'
,
placeholder:
'Search authors'
,
data:
{
any_user:
'Any Author'
,
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
selected:
params
[
:author_id
],
field_name:
'author_id'
,
default_label:
'Author'
}
})
.filter-item.inline
-
if
params
[
:type
].
present?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录