Skip to content
Snippets Groups Projects
Commit caf0b0ab authored by Thomas Randolph's avatar Thomas Randolph
Browse files

Use a more obscure string for dropdown separators

The actual rendering of the dividers happens in gl_dropdown.js,
The rest of the files (other than the changelog) are updates to
use the new strings.
parent f7dc2825
No related branches found
No related tags found
No related merge requests found
Pipeline #78300973 failed
This commit is part of merge request !32198. Comments created here will be created in the context of that merge request.
...@@ -689,6 +689,10 @@ GitLabDropdown = (function() { ...@@ -689,6 +689,10 @@ GitLabDropdown = (function() {
GitLabDropdown.prototype.renderItem = function(data, group, index) { GitLabDropdown.prototype.renderItem = function(data, group, index) {
var field, html, selected, text, url, value, rowHidden; var field, html, selected, text, url, value, rowHidden;
var separators = new Map({
'--|GitLab|--divider-item--|GitLab|--': 'divider',
'--|GitLab|--separator-item--|GitLab|--': 'separator',
});
if (!this.options.renderRow) { if (!this.options.renderRow) {
value = this.options.id ? this.options.id(data) : data.id; value = this.options.id ? this.options.id(data) : data.id;
...@@ -715,8 +719,8 @@ GitLabDropdown = (function() { ...@@ -715,8 +719,8 @@ GitLabDropdown = (function() {
html.style.display = 'none'; html.style.display = 'none';
} }
if (data === 'divider' || data === 'separator') { if (separators.has(data)) {
html.className = data; html.className = separators.get(data);
return html; return html;
} }
// Header // Header
......
...@@ -14,7 +14,10 @@ export default class TransferDropdown { ...@@ -14,7 +14,10 @@ export default class TransferDropdown {
} }
buildDropdown() { buildDropdown() {
const extraOptions = [{ id: '', text: __('No parent group') }, 'divider']; const extraOptions = [
{ id: '', text: __('No parent group') },
'--|GitLab|--divider-item--|GitLab|--',
];
this.groupDropdown.glDropdown({ this.groupDropdown.glDropdown({
selectable: true, selectable: true,
......
...@@ -231,7 +231,7 @@ export default class LabelsSelect { ...@@ -231,7 +231,7 @@ export default class LabelsSelect {
}); });
} }
if (extraData.length) { if (extraData.length) {
extraData.push('divider'); extraData.push('--|GitLab|--divider-item--|GitLab|--');
data = extraData.concat(data); data = extraData.concat(data);
} }
} }
......
...@@ -100,7 +100,7 @@ export default class MilestoneSelect { ...@@ -100,7 +100,7 @@ export default class MilestoneSelect {
}); });
} }
if (extraOptions.length) { if (extraOptions.length) {
extraOptions.push('divider'); extraOptions.push('--|GitLab|--divider-item--|GitLab|--');
} }
callback(extraOptions.concat(data)); callback(extraOptions.concat(data));
......
...@@ -34,7 +34,7 @@ export default class NamespaceSelect { ...@@ -34,7 +34,7 @@ export default class NamespaceSelect {
id: null, id: null,
}; };
namespaces.unshift(anyNamespace); namespaces.unshift(anyNamespace);
namespaces.splice(1, 0, 'divider'); namespaces.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
} }
return dataCallback(namespaces); return dataCallback(namespaces);
}); });
......
...@@ -30,7 +30,7 @@ export default class Search { ...@@ -30,7 +30,7 @@ export default class Search {
data.unshift({ data.unshift({
full_name: __('Any'), full_name: __('Any'),
}); });
data.splice(1, 0, 'divider'); data.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
return callback(data); return callback(data);
}); });
}, },
...@@ -57,7 +57,7 @@ export default class Search { ...@@ -57,7 +57,7 @@ export default class Search {
data.unshift({ data.unshift({
name_with_namespace: __('Any'), name_with_namespace: __('Any'),
}); });
data.splice(1, 0, 'divider'); data.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
return data; return data;
}) })
......
...@@ -191,7 +191,7 @@ export class SearchAutocomplete { ...@@ -191,7 +191,7 @@ export class SearchAutocomplete {
// Add group header before list each group // Add group header before list each group
if (lastCategory !== suggestion.category) { if (lastCategory !== suggestion.category) {
if (!firstCategory) { if (!firstCategory) {
data.push('separator'); data.push('--|GitLab|--separator-item--|GitLab|--');
} }
if (firstCategory) { if (firstCategory) {
firstCategory = false; firstCategory = false;
...@@ -221,7 +221,7 @@ export class SearchAutocomplete { ...@@ -221,7 +221,7 @@ export class SearchAutocomplete {
template = s__('SearchAutocomplete|in this group'); template = s__('SearchAutocomplete|in this group');
} }
data.unshift('separator'); data.unshift('--|GitLab|--separator-item--|GitLab|--');
data.unshift({ data.unshift({
icon, icon,
text: term, text: term,
......
...@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) {
} }
if (showDivider) { if (showDivider) {
users.splice(showDivider, 0, 'divider'); users.splice(showDivider, 0, '--|GitLab|--divider-item--|GitLab|--');
} }
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
...@@ -358,7 +358,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -358,7 +358,7 @@ function UsersSelect(currentUser, els, options = {}) {
users.splice(showDivider, 0, selectedUser); users.splice(showDivider, 0, selectedUser);
}); });
users.splice(showDivider + 1, 0, 'divider'); users.splice(showDivider + 1, 0, '--|GitLab|--divider-item--|GitLab|--');
} }
} }
} }
......
---
title: Fix ref switcher separators from conflicting branch names
merge_request: 32198
author:
type: fixed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment