Skip to content

Commit a658e2f

Browse files
authored
Fix long branch name overflows (#30345)
Fixes: #27971 Fixes: #28010 <img width="689" alt="Screenshot 2024-04-09 at 00 19 57" src="https://github.com/go-gitea/gitea/assets/115237/7c895a47-274f-40a6-a126-290658f1982d"> Also fixes a similar issue in issue list where CSS was there but not active because of missing `display: block`. <img width="372" alt="Screenshot 2024-04-09 at 00 18 25" src="https://github.com/go-gitea/gitea/assets/115237/cfbee7cd-2e15-4ac7-96ce-020816f48798">
1 parent 58b204b commit a658e2f

File tree

8 files changed

+29
-30
lines changed

8 files changed

+29
-30
lines changed

templates/repo/branch_dropdown.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
{{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}}
7272
<div class="ui dropdown custom">
7373
<button class="branch-dropdown-button gt-ellipsis ui basic small compact button tw-flex tw-m-0">
74-
<span class="text tw-flex tw-items-center tw-mr-1">
74+
<span class="text tw-flex tw-items-center tw-mr-1 gt-ellipsis">
7575
{{if .release}}
7676
{{ctx.Locale.Tr "repo.release.compare"}}
7777
{{else}}
@@ -80,7 +80,7 @@
8080
{{else}}
8181
{{svg "octicon-git-branch"}}
8282
{{end}}
83-
<strong ref="dropdownRefName" class="tw-ml-2">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong>
83+
<strong ref="dropdownRefName" class="tw-ml-2 tw-inline-block gt-ellipsis">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong>
8484
{{end}}
8585
</span>
8686
{{svg "octicon-triangle-down" 14 "dropdown icon"}}

templates/repo/issue/branch_selector_field.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
{{$.CsrfTokenHtml}}
66
</form>
77
{{/* TODO: share this branch selector dropdown with the same in repo page */}}
8-
<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating filter select-branch dropdown" data-no-results="{{ctx.Locale.Tr "no_results_found"}}">
8+
<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating filter select-branch dropdown tw-max-w-full" data-no-results="{{ctx.Locale.Tr "no_results_found"}}">
99
<div class="ui basic small button">
10-
<span class="text branch-name">{{if .Reference}}{{$.RefEndName}}{{else}}{{ctx.Locale.Tr "repo.issues.no_ref"}}{{end}}</span>
10+
<span class="text branch-name gt-ellipsis">{{if .Reference}}{{$.RefEndName}}{{else}}{{ctx.Locale.Tr "repo.issues.no_ref"}}{{end}}</span>
1111
{{if .HasIssuesOrPullsWritePermission}}{{svg "octicon-triangle-down" 14 "dropdown icon"}}{{end}}
1212
</div>
1313
<div class="menu">
@@ -37,7 +37,7 @@
3737
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div>
3838
{{end}}
3939
{{range .Branches}}
40-
<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div>
40+
<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div>
4141
{{else}}
4242
<div class="item">{{ctx.Locale.Tr "no_results_found"}}</div>
4343
{{end}}

templates/repo/issue/view_title.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
{{else}}
4242
<div class="ui green label issue-state-label">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.open_title"}}</div>
4343
{{end}}
44-
<div class="tw-ml-2">
44+
<div class="tw-ml-2 tw-flex-1 tw-break-anywhere">
4545
{{if .Issue.IsPull}}
4646
{{$headHref := .HeadTarget}}
4747
{{if .HeadBranchLink}}

templates/shared/issuelist.tmpl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,21 @@
8888
</div>
8989
{{end}}
9090
{{if and .Milestone (ne $.listType "milestone")}}
91-
<a class="milestone flex-text-inline" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}>
92-
{{svg "octicon-milestone" 14}}{{.Milestone.Name}}
91+
<a class="milestone flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}>
92+
{{svg "octicon-milestone" 14}}
93+
<span class="gt-ellipsis">{{.Milestone.Name}}</span>
9394
</a>
9495
{{end}}
9596
{{if .Project}}
96-
<a class="project flex-text-inline" href="{{.Project.Link ctx}}">
97-
{{svg .Project.IconName 14}}{{.Project.Title}}
97+
<a class="project flex-text-inline tw-max-w-[300px]" href="{{.Project.Link ctx}}">
98+
{{svg .Project.IconName 14}}
99+
<span class="gt-ellipsis">{{.Project.Title}}</span>
98100
</a>
99101
{{end}}
100102
{{if .Ref}}
101-
<a class="ref flex-text-inline" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}>
102-
{{svg "octicon-git-branch" 14}}{{index $.IssueRefEndNames .ID}}
103+
<a class="ref flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}>
104+
{{svg "octicon-git-branch" 14}}
105+
<span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span>
103106
</a>
104107
{{end}}
105108
{{$tasks := .GetTasks}}

web_src/css/base.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ a.label,
342342

343343
.ui.dropdown .menu > .item {
344344
color: var(--color-text);
345+
overflow: hidden;
346+
text-overflow: ellipsis;
345347
}
346348

347349
.ui.dropdown .menu > .item:hover {

web_src/css/repo.css

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@
5050
width: 300px;
5151
}
5252

53+
.issue-content-right .dropdown > .menu {
54+
max-width: 270px;
55+
min-width: 0;
56+
}
57+
5358
@media (max-width: 767.98px) {
5459
.issue-content-left,
5560
.issue-content-right {
5661
width: 100%;
5762
}
5863
}
5964

60-
.repository .issue-content-right .menu {
61-
overflow-x: auto;
62-
max-height: 500px;
63-
}
64-
6565
.repository .issue-content-right .ui.list .dependency {
6666
padding: 0;
6767
white-space: nowrap;
@@ -113,11 +113,6 @@
113113
left: 0;
114114
}
115115

116-
.repository .filter.menu .ui.dropdown .menu .item {
117-
overflow: hidden;
118-
text-overflow: ellipsis;
119-
}
120-
121116
.repository .select-label .desc {
122117
padding-left: 23px;
123118
}
@@ -672,6 +667,7 @@ td .commit-summary {
672667
font-size: 14px !important;
673668
padding: 7px 10px !important;
674669
border-radius: var(--border-radius-medium) !important;
670+
flex-shrink: 0;
675671
}
676672

677673
.issue-state-label .svg {
@@ -1170,10 +1166,6 @@ td .commit-summary {
11701166
font-size: 14px;
11711167
}
11721168

1173-
.repository .ui.dropdown.filter > .menu {
1174-
margin-top: 1px;
1175-
}
1176-
11771169
.repository.branches .commit-divergence .bar-group {
11781170
position: relative;
11791171
float: left;

web_src/css/repo/issue-list.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040

4141
#issue-list .flex-item-body .branches .branch {
42-
background-color: var(--color-secondary-alpha-40);
42+
background-color: var(--color-secondary-alpha-50);
4343
border-radius: var(--border-radius);
4444
padding: 0 4px;
4545
}
@@ -48,7 +48,9 @@
4848
white-space: nowrap;
4949
overflow: hidden;
5050
text-overflow: ellipsis;
51-
max-width: 10em;
51+
max-width: 200px;
52+
display: inline-block;
53+
vertical-align: top;
5254
}
5355

5456
#issue-list .flex-item-body .checklist progress {

web_src/js/components/RepoBranchTagSelector.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ export default sfc; // activate IDE's Vue plugin
248248
<template>
249249
<div class="ui dropdown custom">
250250
<button class="branch-dropdown-button gt-ellipsis ui basic small compact button tw-flex tw-m-0" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
251-
<span class="text tw-flex tw-items-center tw-mr-1">
251+
<span class="text tw-flex tw-items-center tw-mr-1 gt-ellipsis">
252252
<template v-if="release">{{ textReleaseCompare }}</template>
253253
<template v-else>
254254
<svg-icon v-if="isViewTag" name="octicon-tag"/>
255255
<svg-icon v-else name="octicon-git-branch"/>
256-
<strong ref="dropdownRefName" class="tw-ml-2">{{ refNameText }}</strong>
256+
<strong ref="dropdownRefName" class="tw-ml-2 tw-inline-block gt-ellipsis">{{ refNameText }}</strong>
257257
</template>
258258
</span>
259259
<svg-icon name="octicon-triangle-down" :size="14" class-name="dropdown icon"/>

0 commit comments

Comments
 (0)