Skip to content

Commit 11f3f0c

Browse files
committed
fix table ellipsis
1 parent 65a2d9e commit 11f3f0c

File tree

3 files changed

+24
-34
lines changed

3 files changed

+24
-34
lines changed

templates/admin/notice.tmpl

+6-10
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,26 @@
33
<h4 class="ui top attached header">
44
{{.locale.Tr "admin.notices.system_notice_list"}} ({{.locale.Tr "admin.total" .Total}})
55
</h4>
6-
<table id="notice-table" class="ui attached basic select selectable table unstackable">
6+
<table class="ui attached basic select selectable table unstackable g-table-auto-ellipsis">
77
<thead>
88
<tr>
99
<th></th>
1010
<th>ID</th>
1111
<th>{{.locale.Tr "admin.notices.type"}}</th>
1212
<th>{{.locale.Tr "admin.notices.desc"}}</th>
13-
<th width="100px">{{.locale.Tr "admin.users.created"}}</th>
13+
<th>{{.locale.Tr "admin.users.created"}}</th>
1414
<th>{{.locale.Tr "admin.notices.op"}}</th>
1515
</tr>
1616
</thead>
1717
<tbody>
1818
{{range .Notices}}
1919
<tr>
20-
<td class="collapsing">
21-
<div class="ui fitted checkbox" data-id="{{.ID}}">
22-
<input type="checkbox">
23-
</div>
24-
</td>
20+
<td><div class="ui checkbox gt-db" data-id="{{.ID}}"><input type="checkbox"></div></td>
2521
<td>{{.ID}}</td>
2622
<td>{{$.locale.Tr .TrStr}}</td>
27-
<td class="view-detail"><span class="notice-description text">{{.Description}}</span></td>
28-
<td>{{DateTime "short" .CreatedUnix}}</td>
29-
<td><a href="#">{{svg "octicon-note" 16 "view-detail"}}</a></td>
23+
<td class="view-detail auto-ellipsis" style="width: 80%;"><span class="notice-description">{{.Description}}</span></td>
24+
<td nowrap>{{DateTime "short" .CreatedUnix}}</td>
25+
<td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td>
3026
</tr>
3127
{{end}}
3228
</tbody>

web_src/css/admin.css

-24
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,3 @@
6060
white-space: pre-wrap;
6161
word-wrap: break-word;
6262
}
63-
64-
@media (max-width: 767px) {
65-
.admin #notice-table .notice-description {
66-
max-width: 80vw;
67-
}
68-
}
69-
70-
@media (min-width: 768px) and (max-width: 991px) {
71-
.admin #notice-table .notice-description {
72-
max-width: 360px;
73-
}
74-
}
75-
76-
@media (min-width: 992px) and (max-width: 1200px) {
77-
.admin #notice-table .notice-description {
78-
max-width: 510px;
79-
}
80-
}
81-
82-
@media (min-width: 1201px) {
83-
.admin #notice-table .notice-description {
84-
max-width: 640px;
85-
}
86-
}

web_src/css/helpers.css

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Gitea's tailwind-style CSS helper classes have `gt-` prefix.
33
Gitea's private styles use `g-` prefix.
44
*/
5+
.gt-db { display: block !important; }
56
.gt-df { display: flex !important; }
67
.gt-di { display: inline !important; }
78
.gt-dif { display: inline-flex !important; }
@@ -42,6 +43,23 @@ Gitea's private styles use `g-` prefix.
4243
text-overflow: ellipsis !important;
4344
}
4445

46+
47+
.g-table-auto-ellipsis td.auto-ellipsis {
48+
position: relative;
49+
}
50+
51+
.g-table-auto-ellipsis td.auto-ellipsis span {
52+
position: absolute;
53+
left: 0;
54+
right: 0;
55+
top: 0;
56+
bottom: 0;
57+
padding: inherit;
58+
white-space: nowrap;
59+
overflow: hidden;
60+
text-overflow: ellipsis;
61+
}
62+
4563
/* below class names match Tailwind CSS */
4664
.gt-break-all { word-break: break-all !important; }
4765
.gt-content-center { align-content: center !important; }

0 commit comments

Comments
 (0)