Skip to content

Commit 0e6bf7e

Browse files
silverwindlafriks
andauthored
Comment Header fixes (#13356)
Apply more flexboxes on comment header and remove float hacks. Needs 1.13 backport. Fixes: #13316 Co-authored-by: Lauris BH <[email protected]>
1 parent d01d39d commit 0e6bf7e

File tree

4 files changed

+43
-65
lines changed

4 files changed

+43
-65
lines changed

templates/repo/issue/view_content.tmpl

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,27 @@
2121
{{end}}
2222
<div class="content">
2323
<div class="ui top attached header">
24-
{{if .Issue.OriginalAuthor }}
25-
<span class="text black">
26-
<i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i>
27-
{{ .Issue.OriginalAuthor }}
28-
</span>
29-
<span class="text grey">
30-
{{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
31-
</span>
32-
<span class="text migrate">
33-
{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
34-
</span>
35-
{{else}}
36-
<span class="text grey">
37-
<a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
38-
{{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
39-
</span>
40-
{{end}}
41-
{{if not $.Repository.IsArchived}}
42-
<div class="ui right actions">
24+
<div class="header-left df ac">
25+
{{if .Issue.OriginalAuthor }}
26+
<span class="text black">
27+
<i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i>
28+
{{ .Issue.OriginalAuthor }}
29+
</span>
30+
<span class="text grey">
31+
{{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
32+
</span>
33+
<span class="text migrate">
34+
{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
35+
</span>
36+
{{else}}
37+
<span class="text grey">
38+
<a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
39+
{{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
40+
</span>
41+
{{end}}
42+
</div>
43+
<div class="header-right actions df ac">
44+
{{if not $.Repository.IsArchived}}
4345
{{if gt .Issue.ShowTag 0}}
4446
<div class="ui basic label">
4547
{{if eq .Issue.ShowTag 2}}
@@ -51,8 +53,8 @@
5153
{{end}}
5254
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
5355
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false "IsCommentPoster" $.IsIssuePoster}}
54-
</div>
55-
{{end}}
56+
{{end}}
57+
</div>
5658
</div>
5759
<div class="ui attached segment">
5860
<div class="render-content markdown">

templates/repo/issue/view_content/comments.tmpl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
{{end}}
2121
<div class="content">
2222
<div class="ui top attached header">
23-
{{if .OriginalAuthor }}
24-
<span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
25-
{{else}}
26-
<span class="text grey"><a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span>
27-
{{end}}
28-
{{if not $.Repository.IsArchived}}
29-
<div class="ui right actions">
23+
<div class="header-left df ac">
24+
{{if .OriginalAuthor }}
25+
<span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
26+
{{else}}
27+
<span class="text grey"><a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span>
28+
{{end}}
29+
</div>
30+
<div class="header-right actions df ac">
31+
{{if not $.Repository.IsArchived}}
3032
{{if eq .PosterID .Issue.PosterID }}
3133
<div class="ui basic label">
3234
{{$.i18n.Tr "repo.issues.poster"}}
@@ -43,8 +45,8 @@
4345
{{end}}
4446
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
4547
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
46-
</div>
47-
{{end}}
48+
{{end}}
49+
</div>
4850
</div>
4951
<div class="ui attached segment">
5052
<div class="render-content markdown">

web_src/less/_form.less

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
.ui.attached.header {
1111
background: #f0f0f0;
1212

13-
.right {
14-
margin-top: -5px;
15-
16-
.button {
17-
padding: 8px 10px;
18-
font-weight: normal;
19-
}
13+
.right .button {
14+
padding: 8px 10px;
15+
font-weight: normal;
2016
}
2117
}
2218

web_src/less/_repository.less

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,27 +1002,6 @@
10021002
}
10031003

10041004
.comment {
1005-
1006-
.actions {
1007-
.item {
1008-
float: left;
1009-
1010-
&.context {
1011-
float: none;
1012-
}
1013-
1014-
&.tag {
1015-
margin-right: 5px;
1016-
}
1017-
1018-
&.action {
1019-
margin-top: 6px;
1020-
padding-left: 10px;
1021-
padding-right: 3px;
1022-
}
1023-
}
1024-
}
1025-
10261005
> .content {
10271006
> div:first-child {
10281007
border-top-left-radius: 4px;
@@ -1062,15 +1041,14 @@
10621041
left: 7px;
10631042
}
10641043

1065-
.actions {
1066-
display: flex;
1067-
padding: 0 .5rem;
1068-
1069-
&.right {
1070-
margin: 0;
1071-
}
1044+
.header-left > * + *,
1045+
.header-right > * + * {
1046+
margin-left: .25rem;
1047+
}
10721048

1049+
.actions {
10731050
a {
1051+
padding: .5rem;
10741052
color: rgba(0, 0, 0, .4);
10751053

10761054
&:hover {

0 commit comments

Comments
 (0)