Skip to content

Commit 902be92

Browse files
committed
fix
1 parent 84a2993 commit 902be92

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,6 @@ tag.create_tag_from = Create new tag from '%s'
23542354
tag.create_success = Tag '%s' has been created.
23552355

23562356
topic.manage_topics = Manage Topics
2357-
topic.done = Done
23582357
topic.count_prompt = You cannot select more than 25 topics
23592358
topic.format_prompt = Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23602359

templates/repo/home.tmpl

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,25 @@
2929
{{end}}
3030
</div>
3131
<div class="gt-mt-3" id="repo-topics">
32-
{{range .Topics}}<a class="ui repo-topic large label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
33-
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<a id="manage_topic" class="muted">{{.locale.Tr "repo.topic.manage_topics"}}</a>{{end}}
32+
{{range .Topics}}<a class="ui repo-topic large label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
33+
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="ui button tiny tertiary">{{.locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
3434
</div>
3535
{{end}}
3636
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
37-
<div class="ui repo-topic-edit grid form gt-hidden" id="topic_edit">
38-
<div class="fourteen wide column">
39-
<div class="field">
40-
<div class="ui fluid multiple search selection dropdown">
41-
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Add $i 1) (len $.Topics)}},{{end}}{{end}}">
42-
{{range .Topics}}
43-
<div class="ui small label topic transition visible" data-value="{{.Name}}" style="display: inline-block !important; cursor: default;">{{.Name}}{{svg "octicon-x" 16 "delete icon gt-ml-3 gt-mt-1"}}</div>
44-
{{end}}
45-
<div class="text"></div>
46-
</div>
37+
<div class="ui form gt-hidden gt-df gt-mt-4" id="topic_edit">
38+
<div class="field gt-f1 gt-mr-3">
39+
<div class="ui fluid multiple search selection dropdown">
40+
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Add $i 1) (len $.Topics)}},{{end}}{{end}}">
41+
{{range .Topics}}
42+
{{/* lalels generated by Fomantic still use `<i class="delete icon">`, to avoid mixing different style together and to remind future developers, use it instead of svg*/}}
43+
<div class="ui small label topic transition visible" data-value="{{.Name}}" style="display: inline-block !important; cursor: default;">{{.Name}}<i class="delete icon"></i></div>
44+
{{end}}
45+
<div class="text"></div>
4746
</div>
4847
</div>
49-
<div class="two wide column">
50-
<a class="ui button primary" role="button" tabindex="0" id="save_topic"
51-
data-link="{{.RepoLink}}/topics">{{.locale.Tr "repo.topic.done"}}</a>
48+
<div>
49+
<button class="ui basic button secondary" id="cancel_topic_edit">{{.locale.Tr "cancel"}}</button>
50+
<button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{.locale.Tr "save"}}</button>
5251
</div>
5352
</div>
5453
{{end}}

web_src/js/features/repo-home.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ export function initRepoTopicBar() {
1010
const viewDiv = $('#repo-topics');
1111
const saveBtn = $('#save_topic');
1212
const topicDropdown = $('#topic_edit .dropdown');
13-
const topicForm = $('#topic_edit.ui.form');
13+
const topicDropdownSearch = topicDropdown.find('input.search');
14+
const topicForm = $('#topic_edit');
1415
const topicPrompts = getPrompts();
1516

1617
mgrBtn.on('click', () => {
1718
hideElem(viewDiv);
1819
showElem(editDiv);
20+
topicDropdownSearch.focus();
21+
});
22+
23+
$('#cancel_topic_edit').on('click', () => {
24+
hideElem(editDiv);
25+
showElem(viewDiv);
26+
mgrBtn.focus();
1927
});
2028

2129
function getPrompts() {
@@ -39,13 +47,11 @@ export function initRepoTopicBar() {
3947
viewDiv.children('.topic').remove();
4048
if (topics.length) {
4149
const topicArray = topics.split(',');
42-
43-
const last = viewDiv.children('a').last();
4450
for (let i = 0; i < topicArray.length; i++) {
4551
const link = $('<a class="ui repo-topic large label topic"></a>');
4652
link.attr('href', `${appSubUrl}/explore/repos?q=${encodeURIComponent(topicArray[i])}&topic=1`);
4753
link.text(topicArray[i]);
48-
link.insertBefore(last);
54+
link.insertBefore(mgrBtn); // insert all new topics before manage button
4955
}
5056
}
5157
hideElem(editDiv);

web_src/less/_base.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,10 @@ a.ui.label:hover {
23292329
color: var(--color-text);
23302330
}
23312331

2332+
.ui.tertiary.button:focus {
2333+
color: var(--color-text-dark);
2334+
}
2335+
23322336
.ui.primary.label,
23332337
.ui.primary.labels .label {
23342338
background-color: var(--color-primary) !important;

web_src/less/_repository.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,10 +3042,6 @@ tbody.commit-list {
30423042
}
30433043
}
30443044

3045-
#manage_topic {
3046-
font-size: 12px;
3047-
}
3048-
30493045
.label + #manage_topic {
30503046
margin-left: 5px;
30513047
}

0 commit comments

Comments
 (0)