Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0d1fa878
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,发现更多精彩内容 >>
未验证
提交
0d1fa878
编写于
9月 27, 2016
作者:
L
Luke Bennett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed compare dropdowns to dropdowns with isolated search input
Updated compare specs
上级
166c6cd8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
14 deletion
+41
-14
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/compare_autocomplete.js
+3
-2
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+14
-1
app/views/projects/compare/_form.html.haml
app/views/projects/compare/_form.html.haml
+6
-2
app/views/projects/compare/_ref_dropdown.html.haml
app/views/projects/compare/_ref_dropdown.html.haml
+1
-0
spec/features/compare_spec.rb
spec/features/compare_spec.rb
+17
-9
未找到文件。
app/assets/javascripts/compare_autocomplete.js
浏览文件 @
0d1fa878
...
...
@@ -23,8 +23,9 @@
selectable
:
true
,
filterable
:
true
,
filterByText
:
true
,
fieldName
:
$dropdown
.
attr
(
'
name
'
),
filterInput
:
'
input[type="text"]
'
,
toggleLabel
:
true
,
fieldName
:
$dropdown
.
data
(
'
field-name
'
),
filterInput
:
'
input[type="search"]
'
,
renderRow
:
function
(
ref
)
{
var
link
;
if
(
ref
.
header
!=
null
)
{
...
...
app/assets/stylesheets/pages/projects.scss
浏览文件 @
0d1fa878
...
...
@@ -743,6 +743,19 @@ pre.light-well {
.dropdown-menu
{
width
:
300px
;
}
>
.input-group
>
.compare-dropdown-toggle
{
width
:
200px
;
.dropdown-toggle-text
{
display
:
block
;
height
:
100%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
width
:
100%
;
}
}
}
.clearable-input
{
...
...
@@ -779,4 +792,4 @@ pre.light-well {
border-top-right-radius
:
0
;
border-bottom-right-radius
:
0
;
}
}
\ No newline at end of file
}
app/views/projects/compare/_form.html.haml
浏览文件 @
0d1fa878
...
...
@@ -5,13 +5,17 @@
.form-group.dropdown.compare-form-group.js-compare-from-dropdown
.input-group.inline-input-group
%span
.input-group-addon
from
=
text_field_tag
:from
,
params
[
:from
],
class:
"form-control js-compare-dropdown"
,
required:
true
,
data:
{
refs_url:
refs_namespace_project_path
(
@project
.
namespace
,
@project
),
toggle:
"dropdown"
,
target:
".js-compare-from-dropdown"
,
selected:
params
[
:from
].
presence
}
=
hidden_field_tag
:from
,
params
[
:from
]
=
button_tag
type:
'button'
,
class:
"form-control compare-dropdown-toggle js-compare-dropdown"
,
required:
true
,
data:
{
refs_url:
refs_namespace_project_path
(
@project
.
namespace
,
@project
),
toggle:
"dropdown"
,
target:
".js-compare-from-dropdown"
,
selected:
params
[
:from
],
field_name: :from
}
do
.dropdown-toggle-text
=
params
[
:from
]
||
'Select branch/tag'
=
render
"ref_dropdown"
=
"..."
.form-group.dropdown.compare-form-group.js-compare-to-dropdown
.input-group.inline-input-group
%span
.input-group-addon
to
=
text_field_tag
:to
,
params
[
:to
],
class:
"form-control js-compare-dropdown"
,
required:
true
,
data:
{
refs_url:
refs_namespace_project_path
(
@project
.
namespace
,
@project
),
toggle:
"dropdown"
,
target:
".js-compare-to-dropdown"
,
selected:
params
[
:to
].
presence
}
=
hidden_field_tag
:to
,
params
[
:to
]
=
button_tag
type:
'button'
,
class:
"form-control compare-dropdown-toggle js-compare-dropdown"
,
required:
true
,
data:
{
refs_url:
refs_namespace_project_path
(
@project
.
namespace
,
@project
),
toggle:
"dropdown"
,
target:
".js-compare-to-dropdown"
,
selected:
params
[
:to
],
field_name: :to
}
do
.dropdown-toggle-text
=
params
[
:to
]
||
'Select branch/tag'
=
render
"ref_dropdown"
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
...
...
app/views/projects/compare/_ref_dropdown.html.haml
浏览文件 @
0d1fa878
.dropdown-menu.dropdown-menu-selectable
=
dropdown_title
"Select branch/tag"
=
dropdown_filter
"Filter by branch/tag"
=
dropdown_content
=
dropdown_loading
spec/features/compare_spec.rb
浏览文件 @
0d1fa878
...
...
@@ -12,15 +12,16 @@ describe "Compare", js: true do
describe
"branches"
do
it
"pre-populates fields"
do
expect
(
page
.
find_field
(
"from"
).
value
).
to
eq
(
"master"
)
expect
(
find
(
".js-compare-from-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"master"
)
expect
(
find
(
".js-compare-to-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"master"
)
end
it
"compares branches"
do
fill_in
"from"
,
with:
"fea
"
find
(
"#from"
).
click
select_using_dropdown
"from"
,
"feature
"
expect
(
find
(
".js-compare-from-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"feature"
)
click_link
"feature
"
expect
(
page
.
find_field
(
"from"
).
value
).
to
eq
(
"feature
"
)
select_using_dropdown
"to"
,
"binary-encoding
"
expect
(
find
(
".js-compare-to-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"binary-encoding
"
)
click_button
"Compare"
expect
(
page
).
to
have_content
"Commits"
...
...
@@ -29,14 +30,21 @@ describe "Compare", js: true do
describe
"tags"
do
it
"compares tags"
do
fill_in
"from"
,
with:
"v1
.0"
find
(
"#from"
).
click
select_using_dropdown
"from"
,
"v1.0
.0"
expect
(
find
(
".js-compare-from-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"v1.0.0"
)
click_link
"v1.0
.0"
expect
(
page
.
find_field
(
"from"
).
value
).
to
eq
(
"v1.0
.0"
)
select_using_dropdown
"to"
,
"v1.1
.0"
expect
(
find
(
".js-compare-to-dropdown .dropdown-toggle-text"
)).
to
have_content
(
"v1.1
.0"
)
click_button
"Compare"
expect
(
page
).
to
have_content
"Commits"
end
end
def
select_using_dropdown
(
dropdown_type
,
selection
)
dropdown
=
find
(
".js-compare-
#{
dropdown_type
}
-dropdown"
)
dropdown
.
find
(
".compare-dropdown-toggle"
).
click
dropdown
.
fill_in
(
"Filter by branch/tag"
,
with:
selection
)
click_link
selection
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录