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
93e464f4
Commit
93e464f4
authored
Oct 16, 2016
by
Luke Bennett
Committed by
Stan Hu
Oct 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added logic to handle a revision input that does not exist in the menu
parent
d78c667d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
app/assets/javascripts/compare_autocomplete.js.es6
app/assets/javascripts/compare_autocomplete.js.es6
+12
-1
app/views/projects/compare/_ref_dropdown.html.haml
app/views/projects/compare/_ref_dropdown.html.haml
+2
-2
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+9
-5
No files found.
app/assets/javascripts/compare_autocomplete.js
→
app/assets/javascripts/compare_autocomplete.js
.es6
View file @
93e464f4
...
...
@@ -9,7 +9,10 @@
var $dropdown, selected;
$dropdown = $(this);
selected = $dropdown.data('selected');
return
$dropdown
.
glDropdown
({
const $dropdownContainer = $dropdown.closest('.dropdown');
const $fieldInput = $(`input[name="${$dropdown.data('field-name')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer);
$dropdown.glDropdown({
data: function(term, callback) {
return $.ajax({
url: $dropdown.data('refs-url'),
...
...
@@ -42,6 +45,14 @@
return $el.text().trim();
}
});
$filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return;
const text = $filterInput.val();
$fieldInput.val(text);
$('.dropdown-toggle-text', $dropdown).text(text);
$dropdownContainer.removeClass('open');
});
});
};
...
...
app/views/projects/compare/_ref_dropdown.html.haml
View file @
93e464f4
.dropdown-menu.dropdown-menu-selectable
=
dropdown_title
"Select
branch/tag
"
=
dropdown_filter
"Filter by
branch/tag
"
=
dropdown_title
"Select
Git revision
"
=
dropdown_filter
"Filter by
Git revision
"
=
dropdown_content
=
dropdown_loading
features/steps/project/commits/commits.rb
View file @
93e464f4
...
...
@@ -49,8 +49,8 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step
'I fill compare fields with refs'
do
select_using_dropdown
(
'from'
,
sample_commit
.
parent_id
)
select_using_dropdown
(
'to'
,
sample_commit
.
id
)
select_using_dropdown
(
'from'
,
sample_commit
.
parent_id
,
true
)
select_using_dropdown
(
'to'
,
sample_commit
.
id
,
true
)
click_button
"Compare"
end
...
...
@@ -184,10 +184,14 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
expect
(
page
).
not_to
have_content
"Change some files"
end
def
select_using_dropdown
(
dropdown_type
,
selection
)
def
select_using_dropdown
(
dropdown_type
,
selection
,
is_commit
=
false
)
dropdown
=
find
(
".js-compare-
#{
dropdown_type
}
-dropdown"
)
dropdown
.
find
(
".compare-dropdown-toggle"
).
click
dropdown
.
fill_in
(
"Filter by branch/tag"
,
with:
selection
)
find_link
(
selection
,
visible:
true
).
click
dropdown
.
fill_in
(
"Filter by Git revision"
,
with:
selection
)
if
is_commit
dropdown
.
find
(
'input[type="search"]'
).
send_keys
(
:return
)
else
find_link
(
selection
,
visible:
true
).
click
end
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