Skip to content

Commit a9cceb0

Browse files
authored
Fix long project name display in issue list and in related dropdown (#23653)
This PR is to fix the second problem mentioned in #23625, along with the long texts problem in `issue-item-bottom-row` of `issuelist.tmpl` Main changes are: 1. Add `max-width` to the search dropdowns in issue list and make the possible long texts inside to show ellipsis if texts are long 2. Adjust the conditions in [issuelist.tmpl](https://github.com/go-gitea/gitea/blob/1d35fa0e784dffcadacb2322a3d7ac3ec2ff89b2/templates/shared/issuelist.tmpl#L146-L167) to fix the problem as mentioned by the [comment](#23625 (comment)) 3. Use `word-break: break-word;` in `issue-item-bottom-row` to break the possible long texts. After the PR issuelist in repo (similar for pr list): <img width="366" alt="截屏2023-03-23 17 42 40" src="https://user-images.githubusercontent.com/17645053/227163953-93e9adbd-5785-4c16-b538-9db901787775.png"> dropdowns with long name (Here take reference from github to deal with the long names cases: show ellipsis with no title, because all these options are clickable, and it might not be necessary to add titles to them ): <img width="370" alt="截屏2023-03-23 17 43 50" src="https://user-images.githubusercontent.com/17645053/227164215-df6fcaaa-9fee-4256-a57c-053fbcffafbb.png"> <img width="365" alt="截屏2023-03-23 17 43 56" src="https://user-images.githubusercontent.com/17645053/227164227-9c99abcd-f410-4e07-b5b8-cbce764eedcd.png"> issue page (similar for pr page): <img width="374" alt="截屏2023-03-23 17 45 37" src="https://user-images.githubusercontent.com/17645053/227164668-654a8188-dac8-4bbf-a6e3-f3768a644a1b.png"> on PC: <img width="1412" alt="截屏2023-03-23 17 47 20" src="https://user-images.githubusercontent.com/17645053/227166694-e7bcc6e5-9667-4cef-9fbf-db85640a2c6c.png"> <img width="1433" alt="截屏2023-03-23 17 46 40" src="https://user-images.githubusercontent.com/17645053/227165182-4e2a5d19-74bc-4c66-b73c-23cbca176ffe.png">
1 parent 84daddc commit a9cceb0

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

templates/repo/issue/list.tmpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
{{.locale.Tr "repo.issues.new.open_projects"}}
100100
</div>
101101
{{range .OpenProjects}}
102-
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
103-
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
102+
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item gt-df" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
103+
{{svg .IconName 18 "gt-mr-3 gt-shrink-0"}}<span class="gt-ellipsis">{{.Title}}</span>
104104
</a>
105105
{{end}}
106106
{{end}}
@@ -131,7 +131,7 @@
131131
</div>
132132
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
133133
{{range .Posters}}
134-
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
134+
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item gt-df" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
135135
{{avatar $.Context .}}{{template "repo/search_name" .}}
136136
</a>
137137
{{end}}
@@ -151,7 +151,7 @@
151151
</div>
152152
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
153153
{{range .Assignees}}
154-
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
154+
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item gt-df" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
155155
{{avatar $.Context .}}{{template "repo/search_name" .}}
156156
</a>
157157
{{end}}

templates/repo/search_name.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}
1+
<span class="gt-ellipsis">{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}</span>

templates/shared/issuelist.tmpl

+11-7
Original file line numberDiff line numberDiff line change
@@ -143,28 +143,32 @@
143143
{{end}}
144144
</div>
145145
</div>
146+
{{if or .TotalTrackedTime .Assignees .NumComments}}
146147
<div class="issue-item-icons-right gt-df gt-p-2">
148+
{{if .TotalTrackedTime}}
147149
<div class="issue-item-icon-right text grey">
148-
{{if .TotalTrackedTime}}
149150
{{svg "octicon-clock" 16 "gt-mr-2"}}
150151
{{.TotalTrackedTime | Sec2Time}}
151-
{{end}}
152152
</div>
153+
{{end}}
154+
{{if .Assignees}}
153155
<div class="issue-item-icon-right text grey">
154156
{{range .Assignees}}
155157
<a class="ui assignee tooltip gt-tdn" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-position="left center">
156158
{{avatar $.Context .}}
157159
</a>
158160
{{end}}
159161
</div>
162+
{{end}}
163+
{{if .NumComments}}
160164
<div class="issue-item-icon-right text grey">
161-
{{if .NumComments}}
162-
<a class="gt-tdn muted" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
163-
{{svg "octicon-comment" 16 "gt-mr-2"}}{{.NumComments}}
164-
</a>
165-
{{end}}
165+
<a class="gt-tdn muted" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
166+
{{svg "octicon-comment" 16 "gt-mr-2"}}{{.NumComments}}
167+
</a>
166168
</div>
169+
{{end}}
167170
</div>
171+
{{end}}
168172
</li>
169173
{{end}}
170174
{{if .IssueIndexerUnavailable}}

web_src/css/helpers.css

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197

198198
.gt-content-center { align-content: center !important; }
199199

200+
.gt-shrink-0 { flex-shrink: 0 !important; }
200201
.gt-whitespace-nowrap { white-space: nowrap !important; }
201202

202203
@media (max-width: 767px) {

web_src/css/repository.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@
143143

144144
.repository .filter.menu .menu {
145145
max-height: 500px;
146-
overflow-x: auto;
146+
max-width: 300px;
147+
overflow-x: hidden;
147148
right: 0 !important;
148149
left: auto !important;
149150
}

web_src/css/shared/issuelist.css

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484

8585
.issue.list > .item .desc a {
8686
color: inherit;
87+
word-break: break-word;
8788
}
8889

8990
.issue.list > .item .desc .time-since,

0 commit comments

Comments
 (0)