Skip to content

Commit

Permalink
Comment Header fixes (go-gitea#13356) (go-gitea#13374)
Browse files Browse the repository at this point in the history
Apply more flexboxes on comment header and remove float hacks. Needs
1.13 backport.

Fixes: go-gitea#13316

Co-authored-by: Lauris BH <lauris@nix.lv>

Co-authored-by: Lauris BH <lauris@nix.lv>
  • Loading branch information
silverwind and lafriks committed Oct 31, 2020
1 parent 77a2d75 commit 52b4b98
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 62 deletions.
44 changes: 23 additions & 21 deletions templates/repo/issue/view_content.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,27 @@
{{end}}
<div class="content">
<div class="ui top attached header">
{{if .Issue.OriginalAuthor }}
<span class="text black">
<i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i>
{{ .Issue.OriginalAuthor }}
</span>
<span class="text grey">
{{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
</span>
<span class="text migrate">
{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
</span>
{{else}}
<span class="text grey">
<a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
{{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
</span>
{{end}}
{{if not $.Repository.IsArchived}}
<div class="ui right actions">
<div class="header-left df ac">
{{if .Issue.OriginalAuthor }}
<span class="text black">
<i class="fa {{MigrationIcon .Repository.GetOriginalURLHostname}}" aria-hidden="true"></i>
{{ .Issue.OriginalAuthor }}
</span>
<span class="text grey">
{{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
</span>
<span class="text migrate">
{{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
</span>
{{else}}
<span class="text grey">
<a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
{{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
</span>
{{end}}
</div>
<div class="header-right actions df ac">
{{if not $.Repository.IsArchived}}
{{if gt .Issue.ShowTag 0}}
<div class="item tag">
{{if eq .Issue.ShowTag 2}}
Expand All @@ -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}}
</div>
{{end}}
{{end}}
</div>
</div>
<div class="ui attached segment">
<div class="render-content markdown">
Expand Down
20 changes: 11 additions & 9 deletions templates/repo/issue/view_content/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
{{end}}
<div class="content">
<div class="ui top attached header">
{{if .OriginalAuthor }}
<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>
{{else}}
<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>
{{end}}
{{if not $.Repository.IsArchived}}
<div class="ui right actions">
<div class="header-left df ac">
{{if .OriginalAuthor }}
<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>
{{else}}
<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>
{{end}}
</div>
<div class="header-right actions df ac">
{{if not $.Repository.IsArchived}}
{{if eq .PosterID .Issue.PosterID }}
<div class="item tag">
{{$.i18n.Tr "repo.issues.poster"}}
Expand All @@ -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))}}
</div>
{{end}}
{{end}}
</div>
</div>
<div class="ui attached segment">
<div class="render-content markdown">
Expand Down
10 changes: 3 additions & 7 deletions web_src/less/_form.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
30 changes: 6 additions & 24 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@

.tag {
color: #767676;
margin-top: 3px;
padding: 2px 5px;
font-size: 12px;
border: 1px solid rgba(0, 0, 0, .1);
Expand All @@ -969,26 +968,6 @@
}
}

.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;
Expand Down Expand Up @@ -1028,11 +1007,14 @@
left: 7px;
}

.actions {
display: flex;
padding: 0 .5rem;
.header-left > * + *,
.header-right > * + * {
margin-left: .25rem;
}

.actions {
a {
padding: .5rem;
color: rgba(0, 0, 0, .4);

&:hover {
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/themes/theme-arc-green.less
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ a.ui.basic.green.label:hover {

.repository.view.issue .comment-list .comment .tag {
color: #dbdbdb;
border-color: rgb(152, 152, 152);
border-color: #505667;
}

.repository.view.issue .comment-list .timeline-item .badge.badge-commit {
Expand Down

0 comments on commit 52b4b98

Please sign in to comment.