Skip to content

Commit

Permalink
fix branch selector on new issue page
Browse files Browse the repository at this point in the history
fix go-gitea#14185

Signed-off-by: a1012112796 <1012112796@qq.com>
  • Loading branch information
a1012112796 committed Dec 30, 2020
1 parent c074e46 commit 545a787
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/repo/issue/branch_selector_field.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
</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}}
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{$.i18n.Tr "repo.clear_ref"}}</a></strong></div>
{{end}}
{{range .Branches}}
<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div>
{{end}}
</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}}
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.i18n.Tr "repo.clear_ref"}}</a></strong></div>
{{end}}
Expand Down
5 changes: 5 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ function initEditForm() {
function initBranchSelector() {
const $selectBranch = $('.ui.select-branch');
const $branchMenu = $selectBranch.find('.reference-list-menu');
const $isNewIssue = $branchMenu.hasClass('new-issue');
$branchMenu.find('.item:not(.no-select)').click(function () {
const selectedValue = $(this).data('id');
const editMode = $('#editing_mode').val();
$($(this).data('id-selector')).val(selectedValue);
if ($isNewIssue) {
$selectBranch.find('.ui .branch-name').text($(this).data('name'));
return;
}

if (editMode === 'true') {
const form = $('#update_issueref_form');
Expand Down

0 comments on commit 545a787

Please sign in to comment.