Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
41d0f231
Commit
41d0f231
authored
May 04, 2017
by
Luke "Jared" Bennett
Committed by
Jacob Schatz
May 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Web GUI: Unable to create new branch from commit SHA"
parent
3a2b60f7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
9 deletions
+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
No files found.
app/assets/javascripts/new_branch_form.js
View file @
41d0f231
...
...
@@ -34,6 +34,7 @@
filterByText
:
true
,
remote
:
false
,
fieldName
:
$branchSelect
.
data
(
'
field-name
'
),
filterInput
:
'
input[type="search"]
'
,
selectable
:
true
,
isSelectable
:
function
(
branch
,
$el
)
{
return
!
$el
.
hasClass
(
'
is-active
'
);
...
...
@@ -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
()
{
...
...
app/views/projects/branches/new.html.haml
View file @
41d0f231
-
page_title
"New Branch"
-
default_ref
=
params
[
:ref
]
||
@project
.
default_branch
-
if
@error
.alert.alert-danger
...
...
@@ -16,12 +17,11 @@
.help-block.text-danger.js-branch-name-error
.form-group
=
label_tag
:ref
,
'Create from'
,
class:
'control-label'
.col-sm-10
=
hidden_field_tag
:ref
,
params
[
:ref
]
||
@project
.
default_branch
=
dropdown_tag
(
params
[
:ref
]
||
@project
.
default_branch
,
options:
{
toggle_class:
'js-branch-select wide'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search branches"
,
data:
{
selected:
params
[
:ref
]
||
@project
.
default_branch
,
field_name:
'ref'
}
})
.col-sm-10.dropdown.create-from
=
hidden_field_tag
:ref
,
default_ref
=
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
.text-left.dropdown-toggle-text
=
default_ref
=
render
'shared/ref_dropdown'
,
dropdown_class:
'wide'
.help-block
Existing branch name, tag, or commit SHA
.form-actions
=
button_tag
'Create branch'
,
class:
'btn btn-create'
,
tabindex:
3
...
...
app/views/projects/compare/_form.html.haml
View file @
41d0f231
...
...
@@ -9,7 +9,7 @@
=
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
.dropdown-toggle-text.str-truncated
=
params
[
:from
]
||
'Select branch/tag'
=
render
"ref_dropdown"
=
render
'shared/ref_dropdown'
.compare-ellipsis.inline
...
.form-group.dropdown.compare-form-group.to.js-compare-to-dropdown
.input-group.inline-input-group
...
...
@@ -17,7 +17,7 @@
=
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
.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"
-
if
@merge_request
.
present?
...
...
app/views/
projects/compare
/_ref_dropdown.html.haml
→
app/views/
shared
/_ref_dropdown.html.haml
View file @
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_filter
"Filter by Git revision"
=
dropdown_content
...
...
spec/features/projects/branches/new_branch_ref_dropdown_spec.rb
0 → 100644
View file @
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment