1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-09 19:18:20 +00:00

Sort repo topic labels by name (#24123) (#24153)

Backport #24123
Close #24077

Manually backported and tested.

<img width="330" alt="image"
src="https://user-images.githubusercontent.com/2114189/232283645-92cc85dd-ba16-44a9-a7ef-5712b9d285e9.png">
This commit is contained in:
wxiaoguang
2023-04-17 09:00:19 +08:00
committed by GitHub
parent 94fbd44bac
commit 2b32f8b95f
3 changed files with 7 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ export function initRepoTopicBar() {
viewDiv.children('.topic').remove();
if (topics.length) {
const topicArray = topics.split(',');
topicArray.sort();
const last = viewDiv.children('a').last();
for (let i = 0; i < topicArray.length; i++) {
const link = $('<a class="ui repo-topic large label topic"></a>');
@@ -57,12 +57,12 @@ export function initRepoTopicBar() {
topicPrompts.formatPrompt = xhr.responseJSON.message;
const {invalidTopics} = xhr.responseJSON;
const topicLables = topicDropdown.children('a.ui.label');
const topicLabels = topicDropdown.children('a.ui.label');
for (const [index, value] of topics.split(',').entries()) {
for (let i = 0; i < invalidTopics.length; i++) {
if (invalidTopics[i] === value) {
topicLables.eq(index).removeClass('green').addClass('red');
topicLabels.eq(index).removeClass('green').addClass('red');
}
}
}