1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

fix branch selector on new issue page (#14194)

fix #14185

Signed-off-by: a1012112796 <1012112796@qq.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
a1012112796 2021-01-01 02:32:11 +08:00 committed by GitHub
parent ef825bd242
commit b003116fca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -31,7 +31,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="branch-list" class="scrolling menu reference-list-menu"> <div id="branch-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}">
{{if .Issue.Ref}} {{if .Issue.Ref}}
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{$.i18n.Tr "repo.clear_ref"}}</a></strong></div> <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{$.i18n.Tr "repo.clear_ref"}}</a></strong></div>
{{end}} {{end}}
@ -39,7 +39,7 @@
<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div> <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div>
{{end}} {{end}}
</div> </div>
<div id="tag-list" class="scrolling menu reference-list-menu" style="display: none"> <div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}" style="display: none">
{{if .Issue.Ref}} {{if .Issue.Ref}}
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.i18n.Tr "repo.clear_ref"}}</a></strong></div> <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.i18n.Tr "repo.clear_ref"}}</a></strong></div>
{{end}} {{end}}

View file

@ -111,10 +111,15 @@ function initEditForm() {
function initBranchSelector() { function initBranchSelector() {
const $selectBranch = $('.ui.select-branch'); const $selectBranch = $('.ui.select-branch');
const $branchMenu = $selectBranch.find('.reference-list-menu'); const $branchMenu = $selectBranch.find('.reference-list-menu');
const $isNewIssue = $branchMenu.hasClass('new-issue');
$branchMenu.find('.item:not(.no-select)').click(function () { $branchMenu.find('.item:not(.no-select)').click(function () {
const selectedValue = $(this).data('id'); const selectedValue = $(this).data('id');
const editMode = $('#editing_mode').val(); const editMode = $('#editing_mode').val();
$($(this).data('id-selector')).val(selectedValue); $($(this).data('id-selector')).val(selectedValue);
if ($isNewIssue) {
$selectBranch.find('.ui .branch-name').text($(this).data('name'));
return;
}
if (editMode === 'true') { if (editMode === 'true') {
const form = $('#update_issueref_form'); const form = $('#update_issueref_form');