Fix various problems (#37547)
1. Fix ugly commit form "warning" message 2. Use JSONError for "Update PR Branch" response 3. Remove useless "timeline" class 4. Make timeline review default to "comment" to avoid icon missing 5. Align PR's "command line instructions" UI 6. Simply "Update PR branch" button logic And then some TODOs are fixed. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<label>{{ctx.Locale.Tr "repo.editor.signoff_desc"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quick-pull-choice js-quick-pull-choice">
|
||||
<div class="field quick-pull-choice js-quick-pull-choice">
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox {{if not .CommitFormOptions.CanCommitToBranch}}disabled{{end}}">
|
||||
<input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}>
|
||||
@@ -30,9 +30,9 @@
|
||||
{{svg "octicon-git-commit"}}
|
||||
{{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName}}
|
||||
{{if not .CommitFormOptions.CanCommitToBranch}}
|
||||
<div class="ui visible small warning message">
|
||||
<div class="tw-mt-2">
|
||||
{{ctx.Locale.Tr "repo.editor.no_commit_to_branch"}}
|
||||
<ul>
|
||||
<ul class="tw-mb-0">
|
||||
{{if not .CommitFormOptions.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}}
|
||||
{{if and .CommitFormOptions.RequireSigned (not .CommitFormOptions.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}}
|
||||
</ul>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="issue-content">
|
||||
{{$createdStr:= DateUtils.TimeSince .Issue.CreatedUnix}}
|
||||
<div class="issue-content-left comment-list prevent-before-timeline">
|
||||
<div class="ui timeline">
|
||||
<div id="{{.Issue.HashTag}}" class="timeline-item comment first">
|
||||
<div class="issue-content-left">
|
||||
<div class="comment-list">
|
||||
<div id="{{.Issue.HashTag}}" class="timeline-item comment issue-content-comment">
|
||||
{{if .Issue.OriginalAuthor}}
|
||||
<span class="timeline-avatar">
|
||||
{{ctx.AvatarUtils.Avatar nil 40}}
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
{{else if eq .Type 22}}
|
||||
<div class="timeline-item-group" id="{{.HashTag}}">
|
||||
<div class="timeline-item event">
|
||||
{{$reviewType := -1}}
|
||||
{{$reviewType := 2}}{{/* default to "comment" type if the review record is missing */}}
|
||||
{{if .Review}}{{$reviewType = .Review.Type}}{{end}}
|
||||
{{if not .OriginalAuthor}}
|
||||
{{/* Some timeline avatars need a offset to correctly align with their speech bubble.
|
||||
@@ -372,15 +372,17 @@
|
||||
{{ctx.AvatarUtils.Avatar .Poster 40}}
|
||||
</a>
|
||||
{{end}}
|
||||
<span class="badge tw-text-white{{if eq $reviewType 1}}{{if .Review.Official}} tw-bg-green {{else}} tw-bg-grey{{end}}{{else if eq $reviewType 3}} tw-bg-red{{end}}">
|
||||
{{if .Review}}{{svg (printf "octicon-%s" .Review.Type.Icon)}}{{end}}
|
||||
<span class="badge tw-text-white {{if eq $reviewType 1}}{{Iif .Review.Official "tw-bg-green" "tw-bg-grey"}}{{else if eq $reviewType 3}}tw-bg-red{{end}}">
|
||||
{{- if .Review -}}
|
||||
{{- svg (printf "octicon-%s" .Review.Type.Icon) -}}
|
||||
{{- else -}}
|
||||
{{- svg "octicon-comment" -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{if eq $reviewType 1}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}}
|
||||
{{else if eq $reviewType 2}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.comment" $createdStr}}
|
||||
{{else if eq $reviewType 3}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.reject" $createdStr}}
|
||||
{{else}}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
{{end}}
|
||||
{{if $data.ShowUpdatePullInfo}}
|
||||
<div class="item">
|
||||
{{template "repo/issue/view_content/update_branch_by_merge" (dict "MergeBoxData" $data "Issue" $.Issue)}}
|
||||
{{template "repo/issue/view_content/update_branch_by_merge" (dict "MergeBoxData" $data "IssueLink" $.Issue.Link)}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
{{$data := $.MergeBoxData}}
|
||||
{{$pull := $.PullRequest}}
|
||||
<details>
|
||||
<summary>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</summary>
|
||||
<div class="tw-mt-2">
|
||||
<div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div>
|
||||
<summary class="tw-pl-1">{{/* align with other item icon & text */}}
|
||||
<span class="tw-pl-2">{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</span>
|
||||
</summary>
|
||||
<div class="tw-my-[5px]">
|
||||
<div>
|
||||
<h3 class="tw-m-0">{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>
|
||||
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}
|
||||
</div>
|
||||
{{$localBranch := $pull.HeadBranch}}
|
||||
{{if ne $pull.HeadRepo.ID $pull.BaseRepo.ID}}
|
||||
{{$localBranch = print $pull.HeadRepo.OwnerName "-" $pull.HeadBranch}}
|
||||
@@ -19,7 +24,7 @@
|
||||
</div>
|
||||
{{if $data.ShowMergeInstructions}}
|
||||
<div>
|
||||
<h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>
|
||||
<h3 class="tw-m-0">{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>
|
||||
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
|
||||
{{if not $data.AutodetectManualMerge}}
|
||||
<div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div>
|
||||
|
||||
@@ -1,33 +1,24 @@
|
||||
{{$data := $.MergeBoxData}}
|
||||
{{$issue := $.Issue}}
|
||||
{{$issueLink := $.IssueLink}}
|
||||
<div class="tw-w-full flex-left-right">
|
||||
<div class="flex-text-block">
|
||||
{{svg "octicon-alert"}}
|
||||
{{ctx.Locale.Tr "repo.pulls.outdated_with_base_branch"}}
|
||||
</div>
|
||||
<div>
|
||||
{{if and $data.UpdateAllowed $data.UpdateByRebaseAllowed}}
|
||||
<div id="update-pr-branch-with-base" class="ui buttons">
|
||||
<button class="ui button" data-do="{{$issue.Link}}/update">
|
||||
<span class="button-text">
|
||||
{{ctx.Locale.Tr "repo.pulls.update_branch"}}
|
||||
</span>
|
||||
</button>
|
||||
<div class="ui dropdown icon button">
|
||||
{{svg "octicon-triangle-down"}}
|
||||
<div class="menu">
|
||||
<a class="item active selected" data-do="{{$issue.Link}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a>
|
||||
<a class="item" data-do="{{$issue.Link}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{{if $data.UpdateAllowed}}
|
||||
<div class="ui buttons" data-global-init="initRepoPullRequestUpdate">
|
||||
<button class="ui button link-action" data-url="{{$issueLink}}/update">
|
||||
{{ctx.Locale.Tr "repo.pulls.update_branch"}}
|
||||
</button>
|
||||
{{if $data.UpdateByRebaseAllowed}}
|
||||
<div class="ui dropdown icon button">
|
||||
{{svg "octicon-triangle-down"}}
|
||||
<div class="menu">
|
||||
<a class="item selected" data-update-url="{{$issueLink}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a>
|
||||
<a class="item" data-update-url="{{$issueLink}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if and $data.UpdateAllowed (not $data.UpdateByRebaseAllowed)}}
|
||||
<form action="{{$issue.Link}}/update" method="post">
|
||||
<button class="ui compact button">
|
||||
<span class="ui text">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user