0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-16 23:11:10 +01:00

Change review status icons on PR view style to Github style (#10737)

* change the icon of ApproveReview pr from "eye" to "check" like github
* change the icon of RejectReview pr from "x" to "request-change" like github
* add "-" after "{{" which need to be one line (TODO: may be not change all)

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
赵智超 2020-04-03 13:12:42 +08:00 committed by GitHub
parent 3723b0647f
commit f685edf510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 22 deletions

View file

@ -33,10 +33,10 @@ const (
func (rt ReviewType) Icon() string { func (rt ReviewType) Icon() string {
switch rt { switch rt {
case ReviewTypeApprove: case ReviewTypeApprove:
return "eye" return "check"
case ReviewTypeReject: case ReviewTypeReject:
return "x" return "request-changes"
case ReviewTypeComment, ReviewTypeUnknown: case ReviewTypeComment:
return "comment" return "comment"
default: default:
return "comment" return "comment"

View file

@ -44,8 +44,8 @@ func TestReview_LoadCodeComments(t *testing.T) {
} }
func TestReviewType_Icon(t *testing.T) { func TestReviewType_Icon(t *testing.T) {
assert.Equal(t, "eye", ReviewTypeApprove.Icon()) assert.Equal(t, "check", ReviewTypeApprove.Icon())
assert.Equal(t, "x", ReviewTypeReject.Icon()) assert.Equal(t, "request-changes", ReviewTypeReject.Icon())
assert.Equal(t, "comment", ReviewTypeComment.Icon()) assert.Equal(t, "comment", ReviewTypeComment.Icon())
assert.Equal(t, "comment", ReviewTypeUnknown.Icon()) assert.Equal(t, "comment", ReviewTypeUnknown.Icon())
assert.Equal(t, "comment", ReviewType(4).Icon()) assert.Equal(t, "comment", ReviewType(4).Icon())

View file

@ -318,7 +318,10 @@
</div> </div>
{{else if eq .Type 22}} {{else if eq .Type 22}}
<div class="event" id="{{.HashTag}}"> <div class="event" id="{{.HashTag}}">
<span class="issue-symbol">{{svg (printf "octicon-%s" .Review.Type.Icon) 16}}</span> <span class="issue-symbol {{if eq .Review.Type 1}}green
{{- else if eq .Review.Type 2}}grey
{{- else if eq .Review.Type 3}}red
{{- else}}grey{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon) 16}}</span>
{{if .OriginalAuthor }} {{if .OriginalAuthor }}
{{else}} {{else}}
<a class="ui avatar image"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> <a class="ui avatar image"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>

View file

@ -8,9 +8,9 @@
<div class="ui divider"></div> <div class="ui divider"></div>
<div class="review-item"> <div class="review-item">
<span class="type-icon text {{if eq .Type 1}}green <span class="type-icon text {{if eq .Type 1}}green
{{else if eq .Type 2}}grey {{- else if eq .Type 2}}grey
{{else if eq .Type 3}}red {{- else if eq .Type 3}}red
{{else}}grey{{end}}"> {{- else}}grey{{end}}">
{{svg (printf "octicon-%s" .Type.Icon) 16}} {{svg (printf "octicon-%s" .Type.Icon) 16}}
</span> </span>
{{if .Stale}} {{if .Stale}}
@ -40,19 +40,19 @@
{{end}} {{end}}
<div class="comment merge box"> <div class="comment merge box">
<a class="avatar text <a class="avatar text
{{if .Issue.PullRequest.HasMerged}}purple {{- if .Issue.PullRequest.HasMerged}}purple
{{else if .Issue.IsClosed}}grey {{- else if .Issue.IsClosed}}grey
{{else if .IsPullWorkInProgress}}grey {{- else if .IsPullWorkInProgress}}grey
{{else if .IsFilesConflicted}}grey {{- else if .IsFilesConflicted}}grey
{{else if .IsPullRequestBroken}}red {{- else if .IsPullRequestBroken}}red
{{else if .IsBlockedByApprovals}}red {{- else if .IsBlockedByApprovals}}red
{{else if .IsBlockedByRejection}}red {{- else if .IsBlockedByRejection}}red
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow
{{else if and .RequireSigned (not .WillSign)}}}red {{- else if and .RequireSigned (not .WillSign)}}}red
{{else if .Issue.PullRequest.IsChecking}}yellow {{- else if .Issue.PullRequest.IsChecking}}yellow
{{else if .Issue.PullRequest.CanAutoMerge}}green {{- else if .Issue.PullRequest.CanAutoMerge}}green
{{else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a> {{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
<div class="content"> <div class="content">
{{template "repo/pulls/status" .}} {{template "repo/pulls/status" .}}
<div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}"> <div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}">