Comment Header fixes (#13356)

Apply more flexboxes on comment header and remove float hacks. Needs
1.13 backport.

Fixes: https://github.com/go-gitea/gitea/issues/13316

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
silverwind 2020-10-31 14:17:52 +01:00 committed by GitHub
parent d01d39d6cf
commit 0e6bf7e4c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 65 deletions

View File

@ -21,25 +21,27 @@
{{end}} {{end}}
<div class="content"> <div class="content">
<div class="ui top attached header"> <div class="ui top attached header">
{{if .Issue.OriginalAuthor }} <div class="header-left df ac">
<span class="text black"> {{if .Issue.OriginalAuthor }}
<i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> <span class="text black">
{{ .Issue.OriginalAuthor }} <i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i>
</span> {{ .Issue.OriginalAuthor }}
<span class="text grey"> </span>
{{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }} <span class="text grey">
</span> {{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
<span class="text migrate"> </span>
{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}} <span class="text migrate">
</span> {{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
{{else}} </span>
<span class="text grey"> {{else}}
<a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> <span class="text grey">
{{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} <a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
</span> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
{{end}} </span>
{{if not $.Repository.IsArchived}} {{end}}
<div class="ui right actions"> </div>
<div class="header-right actions df ac">
{{if not $.Repository.IsArchived}}
{{if gt .Issue.ShowTag 0}} {{if gt .Issue.ShowTag 0}}
<div class="ui basic label"> <div class="ui basic label">
{{if eq .Issue.ShowTag 2}} {{if eq .Issue.ShowTag 2}}
@ -51,8 +53,8 @@
{{end}} {{end}}
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false "IsCommentPoster" $.IsIssuePoster}} {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "diff" false "IsCommentPoster" $.IsIssuePoster}}
</div> {{end}}
{{end}} </div>
</div> </div>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="render-content markdown"> <div class="render-content markdown">

View File

@ -20,13 +20,15 @@
{{end}} {{end}}
<div class="content"> <div class="content">
<div class="ui top attached header"> <div class="ui top attached header">
{{if .OriginalAuthor }} <div class="header-left df ac">
<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> {{if .OriginalAuthor }}
{{else}} <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>
<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> {{else}}
{{end}} <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>
{{if not $.Repository.IsArchived}} {{end}}
<div class="ui right actions"> </div>
<div class="header-right actions df ac">
{{if not $.Repository.IsArchived}}
{{if eq .PosterID .Issue.PosterID }} {{if eq .PosterID .Issue.PosterID }}
<div class="ui basic label"> <div class="ui basic label">
{{$.i18n.Tr "repo.issues.poster"}} {{$.i18n.Tr "repo.issues.poster"}}
@ -43,8 +45,8 @@
{{end}} {{end}}
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
{{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
</div> {{end}}
{{end}} </div>
</div> </div>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="render-content markdown"> <div class="render-content markdown">

View File

@ -10,13 +10,9 @@
.ui.attached.header { .ui.attached.header {
background: #f0f0f0; background: #f0f0f0;
.right { .right .button {
margin-top: -5px; padding: 8px 10px;
font-weight: normal;
.button {
padding: 8px 10px;
font-weight: normal;
}
} }
} }

View File

@ -1002,27 +1002,6 @@
} }
.comment { .comment {
.actions {
.item {
float: left;
&.context {
float: none;
}
&.tag {
margin-right: 5px;
}
&.action {
margin-top: 6px;
padding-left: 10px;
padding-right: 3px;
}
}
}
> .content { > .content {
> div:first-child { > div:first-child {
border-top-left-radius: 4px; border-top-left-radius: 4px;
@ -1062,15 +1041,14 @@
left: 7px; left: 7px;
} }
.header-left > * + *,
.header-right > * + * {
margin-left: .25rem;
}
.actions { .actions {
display: flex;
padding: 0 .5rem;
&.right {
margin: 0;
}
a { a {
padding: .5rem;
color: rgba(0, 0, 0, .4); color: rgba(0, 0, 0, .4);
&:hover { &:hover {