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
8010de30
Commit
8010de30
authored
Jan 12, 2017
by
Sam Rose
Committed by
samrose3
Jan 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent removing fields from dropdowns on input elements
parent
37c35b11
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+7
-7
app/assets/javascripts/search_autocomplete.js.es6
app/assets/javascripts/search_autocomplete.js.es6
+6
-1
changelogs/unreleased/25312-search-input-cmd-click-issue.yml
changelogs/unreleased/25312-search-input-cmd-click-issue.yml
+4
-0
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
8010de30
...
@@ -653,18 +653,14 @@
...
@@ -653,18 +653,14 @@
isMarking
=
false
;
isMarking
=
false
;
el
.
removeClass
(
ACTIVE_CLASS
);
el
.
removeClass
(
ACTIVE_CLASS
);
if
(
field
&&
field
.
length
)
{
if
(
field
&&
field
.
length
)
{
if
(
isInput
)
{
this
.
clearField
(
field
,
isInput
);
field
.
val
(
''
);
}
else
{
field
.
remove
();
}
}
}
}
else
if
(
el
.
hasClass
(
INDETERMINATE_CLASS
))
{
}
else
if
(
el
.
hasClass
(
INDETERMINATE_CLASS
))
{
isMarking
=
true
;
isMarking
=
true
;
el
.
addClass
(
ACTIVE_CLASS
);
el
.
addClass
(
ACTIVE_CLASS
);
el
.
removeClass
(
INDETERMINATE_CLASS
);
el
.
removeClass
(
INDETERMINATE_CLASS
);
if
(
field
&&
field
.
length
&&
value
==
null
)
{
if
(
field
&&
field
.
length
&&
value
==
null
)
{
field
.
remove
(
);
this
.
clearField
(
field
,
isInput
);
}
}
if
((
!
field
||
!
field
.
length
)
&&
fieldName
)
{
if
((
!
field
||
!
field
.
length
)
&&
fieldName
)
{
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
...
@@ -678,7 +674,7 @@
...
@@ -678,7 +674,7 @@
}
}
}
}
if
(
field
&&
field
.
length
&&
value
==
null
)
{
if
(
field
&&
field
.
length
&&
value
==
null
)
{
field
.
remove
(
);
this
.
clearField
(
field
,
isInput
);
}
}
// Toggle active class for the tick mark
// Toggle active class for the tick mark
el
.
addClass
(
ACTIVE_CLASS
);
el
.
addClass
(
ACTIVE_CLASS
);
...
@@ -828,6 +824,10 @@
...
@@ -828,6 +824,10 @@
return
$
(
this
.
el
).
find
(
"
.dropdown-toggle-text
"
).
text
(
this
.
options
.
toggleLabel
(
selected
,
el
,
instance
));
return
$
(
this
.
el
).
find
(
"
.dropdown-toggle-text
"
).
text
(
this
.
options
.
toggleLabel
(
selected
,
el
,
instance
));
};
};
GitLabDropdown
.
prototype
.
clearField
=
function
(
field
,
isInput
)
{
return
isInput
?
field
.
val
(
''
)
:
field
.
remove
();
};
return
GitLabDropdown
;
return
GitLabDropdown
;
})();
})();
...
...
app/assets/javascripts/search_autocomplete.js.es6
View file @
8010de30
...
@@ -70,12 +70,17 @@
...
@@ -70,12 +70,17 @@
search: {
search: {
fields: ['text']
fields: ['text']
},
},
id: this.getSearchText,
data: this.getData.bind(this),
data: this.getData.bind(this),
selectable: true,
selectable: true,
clicked: this.onClick.bind(this)
clicked: this.onClick.bind(this)
});
});
}
}
getSearchText(selectedObject, el) {
return selectedObject.id ? selectedObject.text : '';
}
getData(term, callback) {
getData(term, callback) {
var _this, contents, jqXHR;
var _this, contents, jqXHR;
_this = this;
_this = this;
...
@@ -365,7 +370,7 @@
...
@@ -365,7 +370,7 @@
onClick(item, $el, e) {
onClick(item, $el, e) {
if (location.pathname.indexOf(item.url) !== -1) {
if (location.pathname.indexOf(item.url) !== -1) {
e.preventDefault();
if (!e.metaKey)
e.preventDefault();
if (!this.badgePresent) {
if (!this.badgePresent) {
if (item.category === 'Projects') {
if (item.category === 'Projects') {
this.projectInputEl.val(item.id);
this.projectInputEl.val(item.id);
...
...
changelogs/unreleased/25312-search-input-cmd-click-issue.yml
0 → 100644
View file @
8010de30
---
title
:
Prevent removal of input fields if it is the parent dropdown element
merge_request
:
8397
author
:
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