]> source.dussan.org Git - gitea.git/commitdiff
Fix long project name display in issue list and in related dropdown (#23653)
authorHester Gong <hestergong@gmail.com>
Fri, 24 Mar 2023 07:11:23 +0000 (15:11 +0800)
committerGitHub <noreply@github.com>
Fri, 24 Mar 2023 07:11:23 +0000 (15:11 +0800)
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](https://github.com/go-gitea/gitea/issues/23625#issuecomment-1479281060)
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">

templates/repo/issue/list.tmpl
templates/repo/search_name.tmpl
templates/shared/issuelist.tmpl
web_src/css/helpers.css
web_src/css/repository.css
web_src/css/shared/issuelist.css

index 726ef25cfe8ad4145d8b19c807a4c764fa35c3b6..38ed3873ba4c87b4b68e5189cb70d557a596f170 100644 (file)
@@ -99,8 +99,8 @@
                                                                        {{.locale.Tr "repo.issues.new.open_projects"}}
                                                                </div>
                                                                {{range .OpenProjects}}
-                                                                       <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}}">
-                                                                               {{svg .IconName 18 "gt-mr-3"}}{{.Title}}
+                                                                       <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}}">
+                                                                               {{svg .IconName 18 "gt-mr-3 gt-shrink-0"}}<span class="gt-ellipsis">{{.Title}}</span>
                                                                        </a>
                                                                {{end}}
                                                        {{end}}
                                                        </div>
                                                        <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>
                                                        {{range .Posters}}
-                                                               <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}}">
+                                                               <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}}">
                                                                        {{avatar $.Context .}}{{template "repo/search_name" .}}
                                                                </a>
                                                        {{end}}
                                                        </div>
                                                        <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>
                                                        {{range .Assignees}}
-                                                               <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}}">
+                                                               <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}}">
                                                                        {{avatar $.Context .}}{{template "repo/search_name" .}}
                                                                </a>
                                                        {{end}}
index 468f6c394cd83e1d26aafd699a06da5c1a2a1ce3..5a481761cc8f422df583e67d7a3ddeb90bc526b4 100644 (file)
@@ -1 +1 @@
-{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}
+<span class="gt-ellipsis">{{.Name}}{{if IsShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}</span>
index 40ddb4dab03a5ba25a403ebe79685b10edea100e..2720f7e26b2a6a3d412dd36b729697f623e4d0d6 100644 (file)
                                        {{end}}
                                </div>
                        </div>
+                       {{if or .TotalTrackedTime .Assignees .NumComments}}
                        <div class="issue-item-icons-right gt-df gt-p-2">
+                               {{if .TotalTrackedTime}}
                                <div class="issue-item-icon-right text grey">
-                                       {{if .TotalTrackedTime}}
                                                {{svg "octicon-clock" 16 "gt-mr-2"}}
                                                {{.TotalTrackedTime | Sec2Time}}
-                                       {{end}}
                                </div>
+                               {{end}}
+                               {{if .Assignees}}
                                <div class="issue-item-icon-right text grey">
                                        {{range .Assignees}}
                                                <a class="ui assignee tooltip gt-tdn" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-position="left center">
                                                </a>
                                        {{end}}
                                </div>
+                               {{end}}
+                               {{if .NumComments}}
                                <div class="issue-item-icon-right text grey">
-                                       {{if .NumComments}}
-                                               <a class="gt-tdn muted" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
-                                                       {{svg "octicon-comment" 16 "gt-mr-2"}}{{.NumComments}}
-                                               </a>
-                                       {{end}}
+                                       <a class="gt-tdn muted" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
+                                               {{svg "octicon-comment" 16 "gt-mr-2"}}{{.NumComments}}
+                                       </a>
                                </div>
+                               {{end}}
                        </div>
+                       {{end}}
                </li>
        {{end}}
        {{if .IssueIndexerUnavailable}}
index 4756d31becff8bffd9b4a37732cf8b7b20c30086..7c7d576db95e4d229605c1cf129306efcf2be0be 100644 (file)
 
 .gt-content-center { align-content: center !important; }
 
+.gt-shrink-0 { flex-shrink: 0 !important; }
 .gt-whitespace-nowrap { white-space: nowrap !important; }
 
 @media (max-width: 767px) {
index eb555abec8443da7ea76ba107c4607cc912eef97..34c76b15c9b2dfe3f0e92a577fcef7774b33b564 100644 (file)
 
 .repository .filter.menu .menu {
   max-height: 500px;
-  overflow-x: auto;
+  max-width: 300px;
+  overflow-x: hidden;
   right: 0 !important;
   left: auto !important;
 }
index 6e2cc737e7d903d6e4a55daa414fb5f47cc4ff56..ebb1ca989b87f9bf74c5676c651443538833dce5 100644 (file)
@@ -84,6 +84,7 @@
 
 .issue.list > .item .desc a {
   color: inherit;
+  word-break: break-word;
 }
 
 .issue.list > .item .desc .time-since,