Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust Sorting for Website "Filter by Label" field dropdown. #3628

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion javascripts/projectsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,17 @@ define(['underscore', 'tag-builder', 'project-ordering'], (
};

this.getLabels = function () {
return _.sortBy(labelsMap, (entry) => entry.name.toLowerCase());
projectLabelsArray = _.sortBy(labelsMap, (entry) =>
entry.name.toLowerCase()
);

// iterate through the array and push words starting with non-letters (symbols or numbers) to the end of the array.
projectLabelsArray.forEach((label, index) => {
if (!label.name[0].match(/[a-zA-Z]/i)) {
projectLabelsArray.push(projectLabelsArray.splice(index, 1, 0).pop());
}
});
return projectLabelsArray;
};

this.getPopularTags = function (popularTagCount) {
Expand Down
Loading