From 0e6bf7e4c9f154680d30fc50a1b38fa507a9e7b7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 31 Oct 2020 14:17:52 +0100 Subject: [PATCH] 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 --- templates/repo/issue/view_content.tmpl | 44 ++++++++++--------- .../repo/issue/view_content/comments.tmpl | 20 +++++---- web_src/less/_form.less | 10 ++--- web_src/less/_repository.less | 34 +++----------- 4 files changed, 43 insertions(+), 65 deletions(-) diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 53a14a28e..be5d5c77f 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -21,25 +21,27 @@ {{end}}
- {{if .Issue.OriginalAuthor }} - - - {{ .Issue.OriginalAuthor }} - - - {{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }} - - - {{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}} - - {{else}} - - {{.Issue.Poster.GetDisplayName}} - {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} - - {{end}} - {{if not $.Repository.IsArchived}} -
+
+ {{if .Issue.OriginalAuthor }} + + + {{ .Issue.OriginalAuthor }} + + + {{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }} + + + {{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}} + + {{else}} + + {{.Issue.Poster.GetDisplayName}} + {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} + + {{end}} +
+
+ {{if not $.Repository.IsArchived}} {{if gt .Issue.ShowTag 0}}
{{if eq .Issue.ShowTag 2}} @@ -51,8 +53,8 @@ {{end}} {{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}} -
- {{end}} + {{end}} +
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index e37c7e7fd..9699371e0 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -20,13 +20,15 @@ {{end}}
- {{if .OriginalAuthor }} - {{ .OriginalAuthor }} {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} - {{else}} - {{.Poster.GetDisplayName}} {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}} - {{end}} - {{if not $.Repository.IsArchived}} -
+
+ {{if .OriginalAuthor }} + {{ .OriginalAuthor }} {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} + {{else}} + {{.Poster.GetDisplayName}} {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}} + {{end}} +
+
+ {{if not $.Repository.IsArchived}} {{if eq .PosterID .Issue.PosterID }}
{{$.i18n.Tr "repo.issues.poster"}} @@ -43,8 +45,8 @@ {{end}} {{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))}} -
- {{end}} + {{end}} +
diff --git a/web_src/less/_form.less b/web_src/less/_form.less index 260910e95..9ca6387bc 100644 --- a/web_src/less/_form.less +++ b/web_src/less/_form.less @@ -10,13 +10,9 @@ .ui.attached.header { background: #f0f0f0; - .right { - margin-top: -5px; - - .button { - padding: 8px 10px; - font-weight: normal; - } + .right .button { + padding: 8px 10px; + font-weight: normal; } } diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 14b342cab..7fe821657 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1002,27 +1002,6 @@ } .comment { - - .actions { - .item { - float: left; - - &.context { - float: none; - } - - &.tag { - margin-right: 5px; - } - - &.action { - margin-top: 6px; - padding-left: 10px; - padding-right: 3px; - } - } - } - > .content { > div:first-child { border-top-left-radius: 4px; @@ -1062,15 +1041,14 @@ left: 7px; } - .actions { - display: flex; - padding: 0 .5rem; - - &.right { - margin: 0; - } + .header-left > * + *, + .header-right > * + * { + margin-left: .25rem; + } + .actions { a { + padding: .5rem; color: rgba(0, 0, 0, .4); &:hover {