Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c81b2613
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,发现更多精彩内容 >>
提交
c81b2613
编写于
3月 15, 2016
作者:
J
Jacob Schatz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bugs with select dropdown and multiselection
上级
ed517c5a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
16 deletion
+21
-16
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+17
-14
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+4
-2
未找到文件。
app/assets/javascripts/gl_dropdown.js.coffee
浏览文件 @
c81b2613
...
...
@@ -231,6 +231,13 @@ class GitLabDropdown
html
=
@
options
.
renderRow
(
data
)
else
selected
=
if
@
options
.
isSelected
then
@
options
.
isSelected
(
data
)
else
false
if
not
selected
value
=
if
@
options
.
id
then
@
options
.
id
(
data
)
else
data
.
id
fieldName
=
@
options
.
fieldName
field
=
@
dropdown
.
parent
().
find
(
"input[name='
#{
fieldName
}
'][value='
#{
value
}
']"
)
if
field
.
length
selected
=
true
url
=
if
@
options
.
url
then
@
options
.
url
(
data
)
else
"#"
text
=
if
@
options
.
text
then
@
options
.
text
(
data
)
else
""
cssClass
=
""
;
...
...
@@ -263,7 +270,7 @@ class GitLabDropdown
rowClicked
:
(
el
)
->
fieldName
=
@
options
.
fieldName
field
=
@
dropdown
.
parent
().
find
(
"input[name='
#{
fieldName
}
']"
)
field
=
@
dropdown
.
parent
().
find
(
"input[name='
#{
fieldName
}
']"
)
selectedIndex
=
el
.
parent
().
index
()
if
@
renderedData
selectedObject
=
@
renderedData
[
selectedIndex
]
...
...
@@ -271,10 +278,11 @@ class GitLabDropdown
field
=
@
dropdown
.
parent
().
find
(
"input[name='
#{
fieldName
}
'][value='
#{
value
}
']"
)
if
el
.
hasClass
(
ACTIVE_CLASS
)
if
@
options
.
multiSelect
console
.
log
field
.
val
(),
value
else
field
.
remove
()
console
.
log
'has ACTIVE_CLASS'
# if @options.multiSelect
# console.log field.val(), value
# else
field
.
remove
()
else
fieldName
=
@
options
.
fieldName
selectedIndex
=
el
.
parent
().
index
()
...
...
@@ -286,11 +294,7 @@ class GitLabDropdown
if
!
value
?
field
.
remove
()
if
@
options
.
multiSelect
oldValue
=
field
.
val
()
if
oldValue
value
=
"
#{
oldValue
}
,
#{
value
}
"
else
if
not
@
options
.
multiSelect
@
dropdown
.
find
(
".
#{
ACTIVE_CLASS
}
"
).
removeClass
ACTIVE_CLASS
# Toggle active class for the tick mark
...
...
@@ -299,14 +303,13 @@ class GitLabDropdown
# Toggle the dropdown label
if
@
options
.
toggleLabel
$
(
@
el
).
find
(
".dropdown-toggle-text"
).
text
@
options
.
toggleLabel
(
selectedObject
)
if
value
?
if
!
field
.
length
# Create hidden input for form
input
=
"<input type='hidden' name='
#{
fieldName
}
' />"
input
=
"<input type='hidden' name='
#{
fieldName
}
'
value='
#{
value
}
'
/>"
@
dropdown
.
before
input
@
dropdown
.
parent
().
find
(
"input[name='
#{
fieldName
}
']"
).
val
value
else
console
.
log
'has field???'
selectFirstRow
:
->
selector
=
'.dropdown-content li:first-child a'
...
...
app/views/shared/issuable/_sidebar.html.haml
浏览文件 @
c81b2613
...
...
@@ -65,7 +65,8 @@
.light
None
.selectbox.hide-collapsed
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"milestone_id"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
),
use_id:
true
}})
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone
.
id
,
id:
nil
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"issue[milestone_id]"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
),
use_id:
true
}})
-
if
issuable
.
project
.
labels
.
any?
.block.labels
...
...
@@ -85,7 +86,8 @@
-
else
.light
None
.selectbox.hide-collapsed
=
f
.
hidden_field
'label_name'
,
value:
issuable
.
labels
.
map
(
&
:id
).
join
(
','
)
-
issuable
.
labels
.
each
do
|
label
|
=
f
.
hidden_field
'label_name'
,
value:
label
.
id
,
id:
nil
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"issue[label_name]"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
issuable
.
label_names
.
join
(
","
),
project_id:
(
@project
.
id
if
@project
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录