Skip to content

Commit b6849b8

Browse files
author
0ko
committed
Merge pull request 'Port: Fix long branch name overflows (go-gitea/gitea#30345)' (#3890) from 0ko/forgejo:fix-branch-overflow-2 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3890 Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
2 parents b2eba34 + f6c1fd7 commit b6849b8

File tree

8 files changed

+29
-30
lines changed

8 files changed

+29
-30
lines changed

templates/repo/branch_dropdown.tmpl

+2-2
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/view_content/sidebar/branch_selector_field.tmpl

+3-3
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 "repo.pulls.no_results"}}">
8+
<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating filter select-branch dropdown tw-max-w-full" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}">
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 "repo.pulls.no_results"}}</div>
4343
{{end}}

templates/repo/issue/view_title.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
{{else}}
4848
<div class="ui green label issue-state-label">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.open_title"}}</div>
4949
{{end}}
50-
<div class="tw-ml-2">
50+
<div class="tw-ml-2 tw-flex-1 tw-break-anywhere">
5151
{{if .Issue.IsPull}}
5252
{{$headHref := .HeadTarget}}
5353
{{if .HeadBranchLink}}

templates/shared/issuelist.tmpl

+9-6
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

+2
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ a.label,
423423

424424
.ui.dropdown .menu > .item {
425425
color: var(--color-text);
426+
overflow: hidden;
427+
text-overflow: ellipsis;
426428
}
427429

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

web_src/css/repo.css

+6-14
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
}
@@ -666,6 +661,7 @@ td .commit-summary {
666661
font-size: 14px !important;
667662
padding: 7px 10px !important;
668663
border-radius: var(--border-radius-medium) !important;
664+
flex-shrink: 0;
669665
}
670666

671667
.issue-state-label .svg {
@@ -1186,10 +1182,6 @@ td .commit-summary {
11861182
color: var(--color-text-light-2);
11871183
}
11881184

1189-
.repository .ui.dropdown.filter > .menu {
1190-
margin-top: 1px;
1191-
}
1192-
11931185
.repository.branches .commit-divergence .bar-group {
11941186
position: relative;
11951187
float: left;

web_src/css/repo/issue-list.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
}
7575

7676
#issue-list .flex-item-body .branches .branch {
77-
background-color: var(--color-secondary-alpha-40);
77+
background-color: var(--color-secondary-alpha-50);
7878
border-radius: var(--border-radius);
7979
padding: 0 4px;
8080
}
@@ -83,7 +83,9 @@
8383
white-space: nowrap;
8484
overflow: hidden;
8585
text-overflow: ellipsis;
86-
max-width: 10em;
86+
max-width: 200px;
87+
display: inline-block;
88+
vertical-align: top;
8789
}
8890

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

web_src/js/components/RepoBranchTagSelector.vue

+2-2
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)