Skip to content

Commit 4f64688

Browse files
authored
Truncate long commit message header (go-gitea#10301) (go-gitea#10319)
* 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 117dcf1 commit 4f64688

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
@@ -2351,14 +2351,51 @@ tbody.commit-list {
23512351
vertical-align: baseline;
23522352
}
23532353

2354-
.commit-list .message-wrapper {
2354+
.message-wrapper {
23552355
overflow: hidden;
23562356
text-overflow: ellipsis;
23572357
max-width: calc(100% - 50px);
23582358
display: inline-block;
23592359
vertical-align: middle;
23602360
}
23612361

2362+
@media only screen and (max-width: 767.98px) {
2363+
tr.commit-list {
2364+
width: 100%;
2365+
}
2366+
th .message-wrapper {
2367+
display: block;
2368+
max-width: calc(100vw - 70px);
2369+
}
2370+
}
2371+
2372+
@media only screen and (min-width: 768px) and (max-width: 991.98px) {
2373+
tr.commit-list {
2374+
width: 723px;
2375+
}
2376+
th .message-wrapper {
2377+
max-width: 280px;
2378+
}
2379+
}
2380+
2381+
@media only screen and (min-width: 992px) and (max-width: 1199.98px) {
2382+
tr.commit-list {
2383+
width: 933px;
2384+
}
2385+
th .message-wrapper {
2386+
max-width: 490px;
2387+
}
2388+
}
2389+
2390+
@media only screen and (min-width: 1200px) {
2391+
tr.commit-list {
2392+
width: 1127px;
2393+
}
2394+
th .message-wrapper {
2395+
max-width: 680px;
2396+
}
2397+
}
2398+
23622399
.commit-list .commit-summary a {
23632400
text-decoration: underline;
23642401
text-decoration-style: dashed;

0 commit comments

Comments
 (0)