Skip to content

Commit 268f3ed

Browse files
committed
Review fixes and enhancements
1 parent 747e9f7 commit 268f3ed

File tree

5 files changed

+46
-51
lines changed

5 files changed

+46
-51
lines changed

modules/templates/helper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ func NewFuncMap() template.FuncMap {
188188

189189
"FilenameIsImage": FilenameIsImage,
190190
"TabSizeClass": TabSizeClass,
191+
"ReviewTypeColor": ReviewTypeColor,
191192
}
192193
}
193194

modules/templates/util_misc.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
activities_model "code.gitea.io/gitea/models/activities"
16+
issue_model "code.gitea.io/gitea/models/issues"
1617
repo_model "code.gitea.io/gitea/models/repo"
1718
"code.gitea.io/gitea/modules/git"
1819
giturl "code.gitea.io/gitea/modules/git/url"
@@ -135,6 +136,20 @@ func DiffLineTypeToStr(diffType int) string {
135136
return "same"
136137
}
137138

139+
func ReviewTypeColor(review issue_model.Review) string {
140+
switch review.Type {
141+
case 1:
142+
return "green"
143+
case 2:
144+
return "grey"
145+
case 3:
146+
return "red"
147+
case 4:
148+
return "yellow"
149+
}
150+
return "grey"
151+
}
152+
138153
// MigrationIcon returns a SVG name matching the service an issue/comment was migrated from
139154
func MigrationIcon(hostname string) string {
140155
switch hostname {

templates/repo/issue/view_content/pull.tmpl

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if or .PullReviewers .OriginalReviews}}
2-
<div class="comment box">
2+
<div class="comment box timeline-item gt-pt-3 gt-pb-0">
33
<div class="content">
44
<div class="ui segment">
55
<h4>{{$.locale.Tr "repo.issues.review.reviewers"}}</h4>
@@ -8,6 +8,9 @@
88
<div class="ui divider"></div>
99
<div class="review-item">
1010
<div class="review-item-left">
11+
<span class="gt-mr-3 text {{ReviewTypeColor .Review}}">
12+
{{svg (printf "octicon-%s" .Review.Type.Icon) 18}}
13+
</span>
1114
{{if .User}}
1215
<a href="{{.User.HomeLink}}">
1316
{{avatar $.Context .User}}
@@ -34,7 +37,7 @@
3437
</div>
3538
<div class="review-item-right">
3639
{{if .Review.Stale}}
37-
<span class="ui type-icon text grey" data-tooltip-content="{{$.locale.Tr "repo.issues.is_stale"}}">
40+
<span class="ui text grey" data-tooltip-content="{{$.locale.Tr "repo.issues.is_stale"}}">
3841
{{svg "octicon-hourglass" 16 "icon"}}
3942
</span>
4043
{{end}}
@@ -65,18 +68,10 @@
6568
</div>
6669
</div>
6770
{{end}}
68-
<span class="type-icon text {{if eq .Review.Type 1}}green
69-
{{- else if eq .Review.Type 2}}grey
70-
{{- else if eq .Review.Type 3}}red
71-
{{- else if eq .Review.Type 4}}yellow
72-
{{else}}grey{{end}}">
73-
71+
<span class="gt-df gt-ac">
7472
{{if .CanChange}}
75-
<a href="#" class="ui icon re-request-review {{if .Checked}}checked{{end}}" data-issue-id="{{$.Issue.ID}}" data-tooltip-content="{{if .Checked}} {{$.locale.Tr "repo.issues.remove_request_review"}} {{else}} {{$.locale.Tr "repo.issues.re_request_review"}} {{end}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">
76-
{{if .Checked}} {{svg "octicon-trash"}} {{else}} {{svg "octicon-sync"}} {{end}}
77-
</a>
73+
<a href="#" class="ui icon muted re-request-review{{if .Checked}} checked{{end}}" data-issue-id="{{$.Issue.ID}}" data-tooltip-content="{{if .Checked}}{{$.locale.Tr "repo.issues.remove_request_review"}}{{else}}{{$.locale.Tr "repo.issues.re_request_review"}}{{end}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">{{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}}</a>
7874
{{end}}
79-
{{svg (printf "octicon-%s" .Review.Type.Icon)}}
8075
</span>
8176
</div>
8277
</div>
@@ -86,22 +81,17 @@
8681
<div class="ui divider"></div>
8782
<div class="review-item">
8883
<div class="review-item-left">
84+
<span class="gt-mr-3 text {{ReviewTypeColor .Review}}">
85+
{{svg (printf "octicon-%s" .Type.Icon) 18}}
86+
</span>
8987
<a href="{{$.Repository.OriginalURL}}" data-tooltip-content="{{$.locale.Tr "repo.migrated_from_fake" ($.Repository.GetOriginalURLHostname|Escape) | Safe}}">
9088
<span class="text black ">
9189
{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
9290
{{.OriginalAuthor}}
9391
</span>
9492
</a>
9593
</div>
96-
<div class="review-item-right">
97-
<span class="type-icon text {{if eq .Type 1}}green
98-
{{- else if eq .Type 2}}grey
99-
{{- else if eq .Type 3}}red
100-
{{- else if eq .Type 4}}yellow
101-
{{else}}grey{{end}}">
102-
{{svg (printf "octicon-%s" .Type.Icon)}}
103-
</span>
104-
</div>
94+
<div class="review-item-right"></div>
10595
</div>
10696
{{end}}
10797
</div>

templates/repo/issue/view_content/sidebar.tmpl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,11 @@
6161
{{else if .Team}}
6262
<span class="text">{{svg "octicon-people" 16 "teamavatar"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span>
6363
{{end}}
64-
<span class="ui right type-icon text {{if eq .Review.Type 1}}green
65-
{{- else if eq .Review.Type 2}}grey
66-
{{- else if eq .Review.Type 3}}red
67-
{{- else if eq .Review.Type 4}}yellow
68-
{{- else}}grey{{end}} right ">
69-
64+
<span class="ui right gt-df gt-ac gt-gap-3">
7065
{{if .CanChange}}
71-
<a href="#" class="ui icon re-request-review {{if .Checked}}checked{{end}}" data-tooltip-content="{{if .Checked}} {{$.locale.Tr "repo.issues.remove_request_review"}} {{else}} {{$.locale.Tr "repo.issues.re_request_review"}} {{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">
72-
{{if .Checked}} {{svg "octicon-trash"}} {{else}} {{svg "octicon-sync"}} {{end}}
73-
</a>
66+
<a href="#" class="ui muted icon re-request-review{{if .Checked}} checked{{end}}" data-tooltip-content="{{if .Checked}}{{$.locale.Tr "repo.issues.remove_request_review"}}{{else}}{{$.locale.Tr "repo.issues.re_request_review"}}{{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">{{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}}</a>
7467
{{end}}
75-
{{svg (printf "octicon-%s" .Review.Type.Icon)}}
68+
{{svg (printf "octicon-%s" .Review.Type.Icon) 18 (printf "text %s" (ReviewTypeColor .Review))}}
7669
</span>
7770
</div>
7871
{{end}}
@@ -84,7 +77,7 @@
8477
{{.OriginalAuthor}}
8578
</span>
8679
</a>
87-
<span class="ui right type-icon text {{if eq .Type 1}}green
80+
<span class="ui right text {{if eq .Type 1}}green
8881
{{- else if eq .Type 2}}grey
8982
{{- else if eq .Type 3}}red
9083
{{- else if eq .Type 4}}yellow

web_src/css/repository.css

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -691,49 +691,41 @@
691691
margin-right: 5px;
692692
}
693693

694-
.repository.view.issue .pull .merge.box .timeline-avatar {
694+
.repository.view.issue .merge.box .timeline-avatar {
695695
margin-top: 3px;
696696
margin-left: 4px;
697697
}
698698

699-
.repository.view.issue .pull .merge.box .branch-update.grid .row {
699+
.repository.view.issue .merge.box .branch-update.grid .row {
700700
padding-bottom: 1rem;
701701
}
702702

703-
.repository.view.issue .pull .merge.box .branch-update.grid .row .icon {
703+
.repository.view.issue .merge.box .branch-update.grid .row .icon {
704704
margin-top: 1.1rem;
705705
}
706706

707-
.repository.view.issue .pull .review-item {
707+
.repository.view.issue .review-item {
708708
display: flex;
709709
justify-content: space-between;
710710
align-items: center;
711711
}
712712

713-
.repository.view.issue .pull .review-item .review-item-left,
714-
.repository.view.issue .pull .review-item .review-item-right {
713+
.review-item-left,
714+
.review-item-right {
715715
display: flex;
716716
align-items: center;
717717
}
718718

719-
.repository.view.issue .pull .review-item .text {
720-
margin: 0.3em 0 0.5em 0.5em;
721-
}
722-
723-
.repository.view.issue .pull .review-item .type-icon {
724-
align-self: flex-start;
725-
margin-right: 1em;
726-
}
727-
728-
.repository.view.issue .pull .review-item .type-icon i {
729-
line-height: 1.8em;
719+
.review-item-right {
720+
gap: 8px;
721+
margin-left: 4px;
730722
}
731723

732-
.repository.view.issue .pull .review-item .divider {
724+
.repository.view.issue .review-item .divider {
733725
margin: 0.5rem 0;
734726
}
735727

736-
.repository.view.issue .pull .review-item .review-content {
728+
.repository.view.issue .review-item .review-content {
737729
padding: 1em 0 1em 3.8em;
738730
}
739731

@@ -782,6 +774,10 @@
782774
padding-bottom: 8px;
783775
}
784776

777+
.repository.view.issue .comment-list .timeline-item-group .timeline-avatar {
778+
margin-top: 48px;
779+
}
780+
785781
.repository.view.issue .comment-list .timeline-item {
786782
margin-left: 16px;
787783
position: relative;

0 commit comments

Comments
 (0)