Skip to content

Commit b92c142

Browse files
silverwindGiteaBot
andauthored
Clean up various avatar dimensions (#24701)
Clean up a few cases where avatar dimensions were overwritten via CSS, which were no longer needed or were possible to set via HTML width. Also included are two small fixes: - Fix one more case of incorrect avatar offset on review timeline - Vertically center avatars in review sidebar There is more to be done here, but some of the work depends on Fomantic `comment` module removal, or in the case of org member lists, a refactor of the `avatarlink` template to accept a size. <img width="371" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/9c5902fb-2b89-4a7d-a152-60e74c3b2c56"> <img width="306" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/c8d92e2a-91c9-4f4a-a7de-6ae1a6bc0479"> --------- Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 3af2c8e commit b92c142

File tree

10 files changed

+29
-70
lines changed

10 files changed

+29
-70
lines changed

templates/repo/commits_list_small.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
1717

18-
<span class="ui float right shabox">
18+
<span class="ui float right shabox gt-df gt-ac">
1919
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}}
2020
{{$class := "ui sha label"}}
2121
{{if .Signature}}
@@ -32,7 +32,7 @@
3232
{{$class = (printf "%s%s" $class " isWarning")}}
3333
{{end}}
3434
{{end}}
35-
<a href="{{$commitLink}}" rel="nofollow" class="{{$class}}">
35+
<a href="{{$commitLink}}" rel="nofollow" class="gt-ml-3 {{$class}}">
3636
<span class="shortsha">{{ShortSha .ID.String}}</span>
3737
{{if .Signature}}
3838
{{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}}

templates/repo/issue/view_content.tmpl

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
<div class="ui timeline">
1212
<div id="{{.Issue.HashTag}}" class="timeline-item comment first">
1313
{{if .Issue.OriginalAuthor}}
14-
<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
14+
<span class="timeline-avatar">
15+
<img src="{{AppSubUrl}}/assets/img/avatar_default.png" width="40" height="40">
16+
</span>
1517
{{else}}
1618
<a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
17-
{{avatar $.Context .Issue.Poster}}
19+
{{avatar $.Context .Issue.Poster 40}}
1820
</a>
1921
{{end}}
2022
<div class="content comment-container">
@@ -33,7 +35,7 @@
3335
</span>
3436
{{else}}
3537
<a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}">
36-
{{avatar $.Context .Issue.Poster}}
38+
{{avatar $.Context .Issue.Poster 24}}
3739
</a>
3840
<span class="text grey">
3941
{{template "shared/user/authorlink" .Issue.Poster}}
@@ -93,7 +95,7 @@
9395
{{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
9496
<div class="timeline-item comment form">
9597
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
96-
{{avatar $.Context .SignedUser}}
98+
{{avatar $.Context .SignedUser 40}}
9799
</a>
98100
<div class="content">
99101
<form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">

templates/repo/issue/view_content/comments.tmpl

+12-10
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
{{if eq .Type 0}}
1616
<div class="timeline-item comment" id="{{.HashTag}}">
1717
{{if .OriginalAuthor}}
18-
<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
18+
<span class="timeline-avatar">
19+
<img src="{{AppSubUrl}}/assets/img/avatar_default.png" width="40" height="40">
20+
</span>
1921
{{else}}
2022
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
21-
{{avatar $.Context .Poster}}
23+
{{avatar $.Context .Poster 40}}
2224
</a>
2325
{{end}}
2426
<div class="content comment-container">
@@ -38,7 +40,7 @@
3840
{{else}}
3941
{{if gt .Poster.ID 0}}
4042
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
41-
{{avatar $.Context .Poster}}
43+
{{avatar $.Context .Poster 24}}
4244
</a>
4345
{{end}}
4446
<span class="text grey muted-links">
@@ -375,8 +377,8 @@
375377
{{/* Some timeline avatars need a offset to correctly allign with their speech
376378
bubble. The condition depends on review type and for positive reviews whether
377379
there is a comment element or not */}}
378-
<a class="timeline-avatar{{if or (and (eq .Review.Type 1) (or .Content .Attachments)) (eq .Review.Type 2) (eq .Review.Type 3)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
379-
{{avatar $.Context .Poster}}
380+
<a class="timeline-avatar{{if or (and (eq .Review.Type 1) (or .Content .Attachments)) (and (eq .Review.Type 2) (or .Content .Attachments)) (eq .Review.Type 3)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
381+
{{avatar $.Context .Poster 40}}
380382
</a>
381383
{{end}}
382384
<span class="badge{{if eq .Review.Type 1}} gt-bg-green gt-text-white{{else if eq .Review.Type 3}} gt-bg-red gt-text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
@@ -413,7 +415,7 @@
413415
<div class="comment-header-left gt-df gt-ac">
414416
{{if gt .Poster.ID 0}}
415417
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
416-
{{avatar $.Context .Poster}}
418+
{{avatar $.Context .Poster 24}}
417419
</a>
418420
{{end}}
419421
<span class="text grey muted-links">
@@ -482,7 +484,7 @@
482484
{{range $filename, $lines := .Review.CodeComments}}
483485
{{range $line, $comms := $lines}}
484486
<div class="ui segments">
485-
<div class="ui segment gt-py-3 gt-df gt-ac gt-sb">
487+
<div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb">
486488
{{$invalid := (index $comms 0).Invalidated}}
487489
{{$resolved := (index $comms 0).IsResolved}}
488490
{{$resolveDoer := (index $comms 0).ResolveDoer}}
@@ -541,7 +543,7 @@
541543
<div class="comment-header-left gt-df gt-ac">
542544
{{if not .OriginalAuthor}}
543545
<a class="avatar">
544-
{{avatar $.Context .Poster}}
546+
{{avatar $.Context .Poster 20}}
545547
</a>
546548
{{end}}
547549
<span class="text grey muted-links">
@@ -768,7 +770,7 @@
768770
<div class="timeline-item-group">
769771
<div class="timeline-item event" id="{{.HashTag}}">
770772
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
771-
<img src="{{.Poster.AvatarLink $.Context}}">
773+
<img src="{{.Poster.AvatarLink $.Context}}" width="40" height="40">
772774
</a>
773775
<span class="badge grey">{{svg "octicon-x" 16}}</span>
774776
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
@@ -789,7 +791,7 @@
789791
<div class="ui top attached header comment-header-left gt-df gt-ac arrow-top">
790792
{{if gt .Poster.ID 0}}
791793
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
792-
{{avatar $.Context .Poster}}
794+
{{avatar $.Context .Poster 24}}
793795
</a>
794796
{{end}}
795797
<span class="text grey muted-links">

templates/repo/issue/view_content/pull.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
{{- else if .Issue.PullRequest.IsChecking}}yellow
116116
{{- else if .Issue.PullRequest.IsEmpty}}grey
117117
{{- else if .Issue.PullRequest.CanAutoMerge}}green
118-
{{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
118+
{{- else}}red{{end}}">{{svg "octicon-git-merge" 40}}</a>
119119
<div class="content">
120120
{{template "repo/pulls/status" .}}
121121
{{$showGeneralMergeForm := false}}

templates/shared/issuelist.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<div class="issue-item-icon-right text grey">
154154
{{range .Assignees}}
155155
<a class="ui assignee gt-tdn" href="{{.HomeLink}}" data-tooltip-content="{{.GetDisplayName}}">
156-
{{avatar $.Context .}}
156+
{{avatar $.Context . 20}}
157157
</a>
158158
{{end}}
159159
</div>

web_src/css/base.css

-5
Original file line numberDiff line numberDiff line change
@@ -1903,11 +1903,6 @@ img.ui.avatar,
19031903
color: var(--color-text-light);
19041904
}
19051905

1906-
.repo-title .avatar {
1907-
width: 32px !important;
1908-
height: 32px !important;
1909-
}
1910-
19111906
.repo-title .labels {
19121907
margin-left: 0.5rem;
19131908
}

web_src/css/modules/comment.css

+1-13
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,8 @@
4747
}
4848

4949
.ui.comments .comment .avatar {
50-
display: block;
51-
width: 2.5em;
52-
height: auto;
5350
float: left;
54-
margin: 0.2em 0 0;
55-
}
56-
57-
.ui.comments .comment img.avatar,
58-
.ui.comments .comment .avatar img {
59-
display: block;
60-
margin: 0 auto;
61-
width: 100%;
62-
height: 100%;
63-
border-radius: 0.25rem;
51+
width: 2.5em;
6452
}
6553

6654
.ui.comments .comment > .content {

web_src/css/organization.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170

171171
.organization.members .list .item .ui.avatar {
172172
width: 48px;
173-
height: auto;
173+
height: 48px;
174174
margin-right: 1rem;
175175
align-self: flex-start;
176176
}

web_src/css/repository.css

+5-31
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,6 @@
691691
margin-right: 5px;
692692
}
693693

694-
.repository.view.issue .merge.box .timeline-avatar {
695-
margin-top: 3px;
696-
margin-left: 4px;
697-
}
698-
699694
.repository.view.issue .merge.box .branch-update.grid .row {
700695
padding-bottom: 1rem;
701696
}
@@ -788,23 +783,11 @@
788783
left: -68px;
789784
}
790785

791-
.repository.view.issue .comment-list .timeline-item .timeline-avatar img {
792-
width: 40px !important;
793-
height: 40px !important;
794-
}
795-
796786
/* Don't show the mobile oriented avatar ".inline-timeline-avatar" on desktop. Desktop uses the avatar with class ".timeline-avatar" */
797787
.repository.view.issue .comment-list .timeline-item .inline-timeline-avatar {
798788
display: none;
799789
}
800790

801-
.repository.view.issue .comment-list .timeline-item img.avatar,
802-
.repository.view.issue .comment-list .timeline-item .avatar img {
803-
width: 20px;
804-
height: 20px;
805-
vertical-align: middle;
806-
}
807-
808791
.repository.view.issue .comment-list .timeline-item:first-child:not(.commit) {
809792
padding-top: 0 !important;
810793
}
@@ -1063,12 +1046,12 @@
10631046

10641047
.repository.view.issue .comment-list .code-comment {
10651048
border: 1px solid transparent;
1066-
padding: 0.25rem 0.5rem;
10671049
margin: 0;
10681050
}
10691051

1070-
.repository.view.issue .comment-list .code-comment .content {
1071-
border: none !important;
1052+
/* fix fomantic's border-radius via :first-child with hidden elements */
1053+
.collapsible-comment-box:has(.gt-hidden) {
1054+
border-radius: var(--border-radius) !important;
10721055
}
10731056

10741057
.repository.view.issue .comment-list .code-comment .comment-header {
@@ -1091,13 +1074,7 @@
10911074
}
10921075

10931076
.repository.view.issue .comment-list .comment > .avatar ~ .content {
1094-
margin-left: 3em;
1095-
}
1096-
1097-
.repository.view.issue .comment-code-cloud .comment-list .code-comment img.avatar,
1098-
.repository.view.issue .comment-code-cloud .comment-list .comment img.avatar {
1099-
width: 28px;
1100-
height: 28px;
1077+
margin-left: 42px;
11011078
}
11021079

11031080
.repository.view.issue .comment-list .comment-code-cloud .segment.reactions {
@@ -3085,6 +3062,7 @@ td.blob-excerpt {
30853062
}
30863063

30873064
.sidebar-item-link {
3065+
display: inline-flex;
30883066
align-items: center;
30893067
word-break: break-all;
30903068
}
@@ -3260,10 +3238,6 @@ td.blob-excerpt {
32603238
margin-left: 6px;
32613239
margin-right: 2px;
32623240
}
3263-
.repository.view.issue .comment-list .timeline .inline-timeline-avatar img.avatar {
3264-
height: 24px;
3265-
width: 24px;
3266-
}
32673241
.repository.view.issue .comment-list .timeline .comment-header {
32683242
padding-left: 4px;
32693243
}

web_src/css/shared/issuelist.css

-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
}
7070

7171
.issue.list > .item .assignee img {
72-
width: 20px;
73-
height: 20px;
7472
margin-right: 2px;
7573
}
7674

0 commit comments

Comments
 (0)