diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-15 03:29:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-14 15:29:05 -0400 |
commit | 2902d1e9d193a157bccd46cdda449de5443a2fd8 (patch) | |
tree | c443573b022bbe1266cc08900585eb8d97fa93bf /web_src | |
parent | ed81b608cb5bd94ef518393cdd724c4fac1215d4 (diff) | |
download | gitea-2902d1e9d193a157bccd46cdda449de5443a2fd8.tar.gz gitea-2902d1e9d193a157bccd46cdda449de5443a2fd8.zip |
Sort repo topic labels by name (#24123)
Close #24077
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/features/repo-home.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web_src/js/features/repo-home.js b/web_src/js/features/repo-home.js index e08e84b393..55a2771054 100644 --- a/web_src/js/features/repo-home.js +++ b/web_src/js/features/repo-home.js @@ -41,6 +41,7 @@ export function initRepoTopicBar() { viewDiv.children('.topic').remove(); if (topics.length) { const topicArray = topics.split(','); + topicArray.sort(); for (let i = 0; i < topicArray.length; i++) { const link = $('<a class="ui repo-topic large label topic"></a>'); link.attr('href', `${appSubUrl}/explore/repos?q=${encodeURIComponent(topicArray[i])}&topic=1`); @@ -57,12 +58,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'); } } } |