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
Loading
Pipeline #78300973 failed
......@@ -689,6 +689,10 @@ GitLabDropdown = (function() {
GitLabDropdown.prototype.renderItem = function(data, group, index) {
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) {
value = this.options.id ? this.options.id(data) : data.id;
......@@ -715,8 +719,8 @@ GitLabDropdown = (function() {
html.style.display = 'none';
}
if (data === 'divider' || data === 'separator') {
html.className = data;
if (separators.has(data)) {
html.className = separators.get(data);
return html;
}
// Header
......
......@@ -14,7 +14,10 @@ export default class TransferDropdown {
}
buildDropdown() {
const extraOptions = [{ id: '', text: __('No parent group') }, 'divider'];
const extraOptions = [
{ id: '', text: __('No parent group') },
'--|GitLab|--divider-item--|GitLab|--',
];
this.groupDropdown.glDropdown({
selectable: true,
......
......@@ -231,7 +231,7 @@ export default class LabelsSelect {
});
}
if (extraData.length) {
extraData.push('divider');
extraData.push('--|GitLab|--divider-item--|GitLab|--');
data = extraData.concat(data);
}
}
......
......@@ -100,7 +100,7 @@ export default class MilestoneSelect {
});
}
if (extraOptions.length) {
extraOptions.push('divider');
extraOptions.push('--|GitLab|--divider-item--|GitLab|--');
}
callback(extraOptions.concat(data));
......
......@@ -34,7 +34,7 @@ export default class NamespaceSelect {
id: null,
};
namespaces.unshift(anyNamespace);
namespaces.splice(1, 0, 'divider');
namespaces.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
}
return dataCallback(namespaces);
});
......
......@@ -30,7 +30,7 @@ export default class Search {
data.unshift({
full_name: __('Any'),
});
data.splice(1, 0, 'divider');
data.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
return callback(data);
});
},
......@@ -57,7 +57,7 @@ export default class Search {
data.unshift({
name_with_namespace: __('Any'),
});
data.splice(1, 0, 'divider');
data.splice(1, 0, '--|GitLab|--divider-item--|GitLab|--');
return data;
})
......
......@@ -191,7 +191,7 @@ export class SearchAutocomplete {
// Add group header before list each group
if (lastCategory !== suggestion.category) {
if (!firstCategory) {
data.push('separator');
data.push('--|GitLab|--separator-item--|GitLab|--');
}
if (firstCategory) {
firstCategory = false;
......@@ -221,7 +221,7 @@ export class SearchAutocomplete {
template = s__('SearchAutocomplete|in this group');
}
data.unshift('separator');
data.unshift('--|GitLab|--separator-item--|GitLab|--');
data.unshift({
icon,
text: term,
......
......@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if (showDivider) {
users.splice(showDivider, 0, 'divider');
users.splice(showDivider, 0, '--|GitLab|--divider-item--|GitLab|--');
}
if ($dropdown.hasClass('js-multiselect')) {
......@@ -358,7 +358,7 @@ function UsersSelect(currentUser, els, options = {}) {
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