Skip to content

Commit 314740e

Browse files
authored
Truncate long commit message header (#10301)
* Truncate long commit message header * Fix overflow in view commit table * Use @media less * Further improvements * Fix the commit message on small screens * adjust width of minimal table
1 parent b5f28d1 commit 314740e

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

templates/repo/commit_page.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a class="ui floated right blue tiny button" href="{{EscapePound .SourcePath}}">
77
{{.i18n.Tr "repo.diff.browse_source"}}
88
</a>
9-
<h3 class="has-emoji">{{RenderCommitMessage .Commit.Message $.RepoLink $.Repository.ComposeMetas}}{{template "repo/commit_status" .CommitStatus}}</h3>
9+
<h3 class="has-emoji"><span class="message-wrapper"><span class="commit-summary" title="{{.Commit.Summary}}">{{RenderCommitMessage .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</span></span>{{template "repo/commit_status" .CommitStatus}}</h3>
1010
{{if IsMultilineCommitMessage .Commit.Message}}
1111
<pre class="commit-body">{{RenderCommitBody .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
1212
{{end}}

templates/repo/view_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</a>
3030
{{template "repo/commit_status" .LatestCommitStatus}}
3131
{{ $commitLink:= printf "%s/commit/%s" .RepoLink .LatestCommit.ID }}
32-
<span class="grey has-emoji commit-summary" title="{{.LatestCommit.Summary}}">{{RenderCommitMessageLinkSubject .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}}
32+
<span class="grey has-emoji commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{RenderCommitMessageLinkSubject .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}}</span>
3333
{{if IsMultilineCommitMessage .LatestCommit.Message}}
3434
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
3535
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>

web_src/less/_repository.less

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,14 +2383,51 @@ tbody.commit-list {
23832383
vertical-align: baseline;
23842384
}
23852385

2386-
.commit-list .message-wrapper {
2386+
.message-wrapper {
23872387
overflow: hidden;
23882388
text-overflow: ellipsis;
23892389
max-width: calc(100% - 50px);
23902390
display: inline-block;
23912391
vertical-align: middle;
23922392
}
23932393

2394+
@media only screen and (max-width: 767.98px) {
2395+
tr.commit-list {
2396+
width: 100%;
2397+
}
2398+
th .message-wrapper {
2399+
display: block;
2400+
max-width: calc(100vw - 70px);
2401+
}
2402+
}
2403+
2404+
@media only screen and (min-width: 768px) and (max-width: 991.98px) {
2405+
tr.commit-list {
2406+
width: 723px;
2407+
}
2408+
th .message-wrapper {
2409+
max-width: 280px;
2410+
}
2411+
}
2412+
2413+
@media only screen and (min-width: 992px) and (max-width: 1199.98px) {
2414+
tr.commit-list {
2415+
width: 933px;
2416+
}
2417+
th .message-wrapper {
2418+
max-width: 490px;
2419+
}
2420+
}
2421+
2422+
@media only screen and (min-width: 1200px) {
2423+
tr.commit-list {
2424+
width: 1127px;
2425+
}
2426+
th .message-wrapper {
2427+
max-width: 680px;
2428+
}
2429+
}
2430+
23942431
.commit-list .commit-summary a {
23952432
text-decoration: underline;
23962433
text-decoration-style: dashed;

0 commit comments

Comments
 (0)