Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
41d0f231
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,发现更多精彩内容 >>
提交
41d0f231
编写于
5月 04, 2017
作者:
L
Luke "Jared" Bennett
提交者:
Jacob Schatz
5月 04, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve "Web GUI: Unable to create new branch from commit SHA"
上级
3a2b60f7
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
75 addition
and
9 deletion
+75
-9
app/assets/javascripts/new_branch_form.js
app/assets/javascripts/new_branch_form.js
+16
-0
app/views/projects/branches/new.html.haml
app/views/projects/branches/new.html.haml
+6
-6
app/views/projects/compare/_form.html.haml
app/views/projects/compare/_form.html.haml
+2
-2
app/views/shared/_ref_dropdown.html.haml
app/views/shared/_ref_dropdown.html.haml
+3
-1
spec/features/projects/branches/new_branch_ref_dropdown_spec.rb
...eatures/projects/branches/new_branch_ref_dropdown_spec.rb
+48
-0
未找到文件。
app/assets/javascripts/new_branch_form.js
浏览文件 @
41d0f231
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
filterByText
:
true
,
filterByText
:
true
,
remote
:
false
,
remote
:
false
,
fieldName
:
$branchSelect
.
data
(
'
field-name
'
),
fieldName
:
$branchSelect
.
data
(
'
field-name
'
),
filterInput
:
'
input[type="search"]
'
,
selectable
:
true
,
selectable
:
true
,
isSelectable
:
function
(
branch
,
$el
)
{
isSelectable
:
function
(
branch
,
$el
)
{
return
!
$el
.
hasClass
(
'
is-active
'
);
return
!
$el
.
hasClass
(
'
is-active
'
);
...
@@ -50,6 +51,21 @@
...
@@ -50,6 +51,21 @@
}
}
}
}
});
});
const
$dropdownContainer
=
$branchSelect
.
closest
(
'
.dropdown
'
);
const
$fieldInput
=
$
(
`input[name="
${
$branchSelect
.
data
(
'
field-name
'
)}
"]`
,
$dropdownContainer
);
const
$filterInput
=
$
(
'
input[type="search"]
'
,
$dropdownContainer
);
$filterInput
.
on
(
'
keyup
'
,
(
e
)
=>
{
const
keyCode
=
e
.
keyCode
||
e
.
which
;
if
(
keyCode
!==
13
)
return
;
const
text
=
$filterInput
.
val
();
$fieldInput
.
val
(
text
);
$
(
'
.dropdown-toggle-text
'
,
$branchSelect
).
text
(
text
);
$dropdownContainer
.
removeClass
(
'
open
'
);
});
};
};
NewBranchForm
.
prototype
.
setupRestrictions
=
function
()
{
NewBranchForm
.
prototype
.
setupRestrictions
=
function
()
{
...
...
app/views/projects/branches/new.html.haml
浏览文件 @
41d0f231
-
page_title
"New Branch"
-
page_title
"New Branch"
-
default_ref
=
params
[
:ref
]
||
@project
.
default_branch
-
if
@error
-
if
@error
.alert.alert-danger
.alert.alert-danger
...
@@ -16,12 +17,11 @@
...
@@ -16,12 +17,11 @@
.help-block.text-danger.js-branch-name-error
.help-block.text-danger.js-branch-name-error
.form-group
.form-group
=
label_tag
:ref
,
'Create from'
,
class:
'control-label'
=
label_tag
:ref
,
'Create from'
,
class:
'control-label'
.col-sm-10
.col-sm-10.dropdown.create-from
=
hidden_field_tag
:ref
,
params
[
:ref
]
||
@project
.
default_branch
=
hidden_field_tag
:ref
,
default_ref
=
dropdown_tag
(
params
[
:ref
]
||
@project
.
default_branch
,
=
button_tag
type:
'button'
,
title:
default_ref
,
class:
'dropdown-toggle form-control js-branch-select'
,
required:
true
,
data:
{
toggle:
'dropdown'
,
selected:
default_ref
,
field_name:
'ref'
}
do
options:
{
toggle_class:
'js-branch-select wide'
,
.text-left.dropdown-toggle-text
=
default_ref
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search branches"
,
=
render
'shared/ref_dropdown'
,
dropdown_class:
'wide'
data:
{
selected:
params
[
:ref
]
||
@project
.
default_branch
,
field_name:
'ref'
}
})
.help-block
Existing branch name, tag, or commit SHA
.help-block
Existing branch name, tag, or commit SHA
.form-actions
.form-actions
=
button_tag
'Create branch'
,
class:
'btn btn-create'
,
tabindex:
3
=
button_tag
'Create branch'
,
class:
'btn btn-create'
,
tabindex:
3
...
...
app/views/projects/compare/_form.html.haml
浏览文件 @
41d0f231
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
=
hidden_field_tag
:from
,
params
[
:from
]
=
hidden_field_tag
:from
,
params
[
:from
]
=
button_tag
type:
'button'
,
title:
params
[
:from
],
class:
"form-control compare-dropdown-toggle js-compare-dropdown has-tooltip"
,
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
=
button_tag
type:
'button'
,
title:
params
[
:from
],
class:
"form-control compare-dropdown-toggle js-compare-dropdown has-tooltip"
,
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.str-truncated
=
params
[
:from
]
||
'Select branch/tag'
.dropdown-toggle-text.str-truncated
=
params
[
:from
]
||
'Select branch/tag'
=
render
"ref_dropdown"
=
render
'shared/ref_dropdown'
.compare-ellipsis.inline
...
.compare-ellipsis.inline
...
.form-group.dropdown.compare-form-group.to.js-compare-to-dropdown
.form-group.dropdown.compare-form-group.to.js-compare-to-dropdown
.input-group.inline-input-group
.input-group.inline-input-group
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
hidden_field_tag
:to
,
params
[
:to
]
=
hidden_field_tag
:to
,
params
[
:to
]
=
button_tag
type:
'button'
,
title:
params
[
:to
],
class:
"form-control compare-dropdown-toggle js-compare-dropdown has-tooltip"
,
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
=
button_tag
type:
'button'
,
title:
params
[
:to
],
class:
"form-control compare-dropdown-toggle js-compare-dropdown has-tooltip"
,
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.str-truncated
=
params
[
:to
]
||
'Select branch/tag'
.dropdown-toggle-text.str-truncated
=
params
[
:to
]
||
'Select branch/tag'
=
render
"ref_dropdown"
=
render
'shared/ref_dropdown'
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
-
if
@merge_request
.
present?
-
if
@merge_request
.
present?
...
...
app/views/
projects/compare
/_ref_dropdown.html.haml
→
app/views/
shared
/_ref_dropdown.html.haml
浏览文件 @
41d0f231
.dropdown-menu.dropdown-menu-selectable
-
dropdown_class
=
local_assigns
.
fetch
(
:dropdown_class
,
''
)
.dropdown-menu.dropdown-menu-selectable
{
class:
dropdown_class
}
=
dropdown_title
"Select Git revision"
=
dropdown_title
"Select Git revision"
=
dropdown_filter
"Filter by Git revision"
=
dropdown_filter
"Filter by Git revision"
=
dropdown_content
=
dropdown_content
...
...
spec/features/projects/branches/new_branch_ref_dropdown_spec.rb
0 → 100644
浏览文件 @
41d0f231
require
'spec_helper'
describe
'New Branch Ref Dropdown'
,
:js
,
:feature
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:toggle
)
{
find
(
'.create-from .dropdown-toggle'
)
}
before
do
project
.
add_master
(
user
)
login_as
(
user
)
visit
new_namespace_project_branch_path
(
project
.
namespace
,
project
)
end
it
'filters a list of branches and tags'
do
toggle
.
click
filter_by
(
'v1.0.0'
)
expect
(
items_count
).
to
be
(
1
)
filter_by
(
'video'
)
expect
(
items_count
).
to
be
(
1
)
find
(
'.create-from .dropdown-content li'
).
click
expect
(
toggle
).
to
have_content
'video'
end
it
'accepts a manually entered commit SHA'
do
toggle
.
click
filter_by
(
'somecommitsha'
)
find
(
'.create-from input[type=search]'
).
send_keys
(
:enter
)
expect
(
toggle
).
to
have_content
'somecommitsha'
end
def
items_count
all
(
'.create-from .dropdown-content li'
).
length
end
def
filter_by
(
filter_text
)
fill_in
'Filter by Git revision'
,
with:
filter_text
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录