From c5f54df94c6b8ee1300b4aae007b16155f2be9e1 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Fri, 20 Mar 2020 08:52:47 +0800 Subject: [PATCH] change review status icons on pr view style to github style * 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> --- models/review.go | 6 ++-- models/review_test.go | 4 +-- .../repo/issue/view_content/comments.tmpl | 5 ++- templates/repo/issue/view_content/pull.tmpl | 32 +++++++++---------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/models/review.go b/models/review.go index ec28b41d35db..993b5577bd89 100644 --- a/models/review.go +++ b/models/review.go @@ -33,10 +33,10 @@ const ( func (rt ReviewType) Icon() string { switch rt { case ReviewTypeApprove: - return "eye" + return "check" case ReviewTypeReject: - return "x" - case ReviewTypeComment, ReviewTypeUnknown: + return "request-changes" + case ReviewTypeComment: return "comment" default: return "comment" diff --git a/models/review_test.go b/models/review_test.go index a94a65f75457..442501240835 100644 --- a/models/review_test.go +++ b/models/review_test.go @@ -44,8 +44,8 @@ func TestReview_LoadCodeComments(t *testing.T) { } func TestReviewType_Icon(t *testing.T) { - assert.Equal(t, "eye", ReviewTypeApprove.Icon()) - assert.Equal(t, "x", ReviewTypeReject.Icon()) + assert.Equal(t, "check", ReviewTypeApprove.Icon()) + assert.Equal(t, "request-changes", ReviewTypeReject.Icon()) assert.Equal(t, "comment", ReviewTypeComment.Icon()) assert.Equal(t, "comment", ReviewTypeUnknown.Icon()) assert.Equal(t, "comment", ReviewType(4).Icon()) diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 2e9d8a32ba17..bb8188def95c 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -318,7 +318,10 @@ {{else if eq .Type 22}}
- {{svg (printf "octicon-%s" .Review.Type.Icon) 16}} + {{svg (printf "octicon-%s" .Review.Type.Icon) 16}} {{if .OriginalAuthor }} {{else}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 758733fc44fd..3714e15cfe77 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -8,9 +8,9 @@
+ {{- else if eq .Type 2}}grey + {{- else if eq .Type 3}}red + {{- else}}grey{{end}}"> {{svg (printf "octicon-%s" .Type.Icon) 16}} {{if .Stale}} @@ -40,19 +40,19 @@ {{end}}
{{svg "octicon-git-merge" 32}} + {{- if .Issue.PullRequest.HasMerged}}purple + {{- else if .Issue.IsClosed}}grey + {{- else if .IsPullWorkInProgress}}grey + {{- else if .IsFilesConflicted}}grey + {{- else if .IsPullRequestBroken}}red + {{- else if .IsBlockedByApprovals}}red + {{- else if .IsBlockedByRejection}}red + {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red + {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow + {{- else if and .RequireSigned (not .WillSign)}}}red + {{- else if .Issue.PullRequest.IsChecking}}yellow + {{- else if .Issue.PullRequest.CanAutoMerge}}green + {{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}
{{template "repo/pulls/status" .}}