Skip to content

Commit e768547

Browse files
committed
feat(tpl): use list element for paths and files
1 parent 9ee588f commit e768547

File tree

4 files changed

+61
-37
lines changed

4 files changed

+61
-37
lines changed

src/tpl/assert/main.css

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ body {
1414
font-family: Consolas, Monaco, "Andale Mono", "DejaVu Sans Mono", monospace;
1515
}
1616

17+
ul, ol, li {
18+
display: block;
19+
margin: 0;
20+
padding: 0;
21+
}
22+
1723
a {
1824
display: block;
1925
padding: 0.4em 0.5em;
@@ -42,20 +48,24 @@ input, button {
4248
zoom: 1;
4349
}
4450

45-
.path-list a {
51+
.path-list li {
4652
position: relative;
4753
float: left;
48-
padding-right: 1.2em;
4954
text-align: center;
5055
white-space: nowrap;
56+
}
57+
58+
.path-list a {
59+
display: block;
60+
padding-right: 1.2em;
5161
min-width: 1em;
5262
}
5363

5464
.path-list a:after {
5565
content: '';
5666
position: absolute;
5767
top: 50%;
58-
right: 0.4em;
68+
right: 0.5em;
5969
width: 0.4em;
6070
height: 0.4em;
6171
border: 1px solid;
@@ -64,11 +74,11 @@ input, button {
6474
transform: rotate(45deg) translateY(-50%);
6575
}
6676

67-
.path-list a:last-child {
77+
.path-list li:last-child a {
6878
padding-right: 0.5em;
6979
}
7080

71-
.path-list a:last-child:after {
81+
.path-list li:last-child a:after {
7282
display: none;
7383
}
7484

src/tpl/assert/main.css.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ color: #333;
1414
font-size: 0.625em;
1515
font-family: Consolas, Monaco, "Andale Mono", "DejaVu Sans Mono", monospace;
1616
}
17+
ul, ol, li {
18+
display: block;
19+
margin: 0;
20+
padding: 0;
21+
}
1722
a {
1823
display: block;
1924
padding: 0.4em 0.5em;
@@ -37,30 +42,33 @@ overflow: hidden;
3742
border-bottom: 1px #999 solid;
3843
zoom: 1;
3944
}
40-
.path-list a {
45+
.path-list li {
4146
position: relative;
4247
float: left;
43-
padding-right: 1.2em;
4448
text-align: center;
4549
white-space: nowrap;
50+
}
51+
.path-list a {
52+
display: block;
53+
padding-right: 1.2em;
4654
min-width: 1em;
4755
}
4856
.path-list a:after {
4957
content: '';
5058
position: absolute;
5159
top: 50%;
52-
right: 0.4em;
60+
right: 0.5em;
5361
width: 0.4em;
5462
height: 0.4em;
5563
border: 1px solid;
5664
border-color: #ccc #ccc transparent transparent;
5765
-webkit-transform: rotate(45deg) translateY(-50%);
5866
transform: rotate(45deg) translateY(-50%);
5967
}
60-
.path-list a:last-child {
68+
.path-list li:last-child a {
6169
padding-right: 0.5em;
6270
}
63-
.path-list a:last-child:after {
71+
.path-list li:last-child a:after {
6472
display: none;
6573
}
6674
.upload {

src/tpl/page.html

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</head>
1515
<body>
1616

17-
<div class="path-list">
18-
{{range .Paths}}
19-
<a href="{{.Path}}">{{html .Name}}</a>
20-
{{end}}
21-
</div>
17+
<ol class="path-list">
18+
{{range .Paths}}
19+
<li><a href="{{.Path}}">{{html .Name}}</a></li>
20+
{{end}}
21+
</ol>
2222

2323
{{if .CanUpload}}
2424
<div class="upload">
@@ -37,22 +37,25 @@
3737
</div>
3838
{{end}}
3939

40-
<div class="item-list">
41-
<a href="{{if .IsRoot}}./{{else}}../{{end}}">
42-
<span class="name">../</span>
43-
<span class="size"></span>
44-
<span class="time"></span>
45-
</a>
46-
{{range .SubItems}}
47-
{{$isDir := .IsDir}}
48-
<a href="{{$subItemPrefix}}{{.Name}}{{if $isDir}}/{{end}}"
49-
class="item {{if $isDir}}item-dir{{else}}item-file{{end}}">
50-
<span class="name">{{html .Name}}{{if $isDir}}/{{end}}</span>
51-
<span class="size">{{if not $isDir}}{{fmtSize .Size}}{{end}}</span>
52-
<span class="time">{{fmtTime .ModTime}}</span>
40+
<ul class="item-list">
41+
<li>
42+
<a href="{{if .IsRoot}}./{{else}}../{{end}}">
43+
<span class="name">../</span>
44+
<span class="size"></span>
45+
<span class="time"></span>
5346
</a>
54-
{{end}}
55-
</div>
47+
</li>
48+
{{range .SubItems}}
49+
{{$isDir := .IsDir}}
50+
<li>
51+
<a href="{{$subItemPrefix}}{{.Name}}{{if $isDir}}/{{end}}" class="item {{if $isDir}}item-dir{{else}}item-file{{end}}">
52+
<span class="name">{{html .Name}}{{if $isDir}}/{{end}}</span>
53+
<span class="size">{{if not $isDir}}{{fmtSize .Size}}{{end}}</span>
54+
<span class="time">{{fmtTime .ModTime}}</span>
55+
</a>
56+
</li>
57+
{{end}}
58+
</ul>
5659

5760
{{range .Errors}}
5861
<div class="error">{{.}}</div>

src/tpl/page.html.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const pageTplStr = `
2222
<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}?assert=main.css"/>
2323
</head>
2424
<body>
25-
<div class="path-list">
25+
<ol class="path-list">
2626
{{range .Paths}}
27-
<a href="{{.Path}}">{{html .Name}}</a>
27+
<li><a href="{{.Path}}">{{html .Name}}</a></li>
2828
{{end}}
29-
</div>
29+
</ol>
3030
{{if .CanUpload}}
3131
<div class="upload">
3232
<form method="POST" enctype="multipart/form-data">
@@ -42,22 +42,25 @@ const pageTplStr = `
4242
<a href="{{$subItemPrefix}}?zip" download="{{.ItemName}}.zip">.zip</a>
4343
</div>
4444
{{end}}
45-
<div class="item-list">
45+
<ul class="item-list">
46+
<li>
4647
<a href="{{if .IsRoot}}./{{else}}../{{end}}">
4748
<span class="name">../</span>
4849
<span class="size"></span>
4950
<span class="time"></span>
5051
</a>
52+
</li>
5153
{{range .SubItems}}
5254
{{$isDir := .IsDir}}
53-
<a href="{{$subItemPrefix}}{{.Name}}{{if $isDir}}/{{end}}"
54-
class="item {{if $isDir}}item-dir{{else}}item-file{{end}}">
55+
<li>
56+
<a href="{{$subItemPrefix}}{{.Name}}{{if $isDir}}/{{end}}" class="item {{if $isDir}}item-dir{{else}}item-file{{end}}">
5557
<span class="name">{{html .Name}}{{if $isDir}}/{{end}}</span>
5658
<span class="size">{{if not $isDir}}{{fmtSize .Size}}{{end}}</span>
5759
<span class="time">{{fmtTime .ModTime}}</span>
5860
</a>
61+
</li>
5962
{{end}}
60-
</div>
63+
</ul>
6164
{{range .Errors}}
6265
<div class="error">{{.}}</div>
6366
{{end}}

0 commit comments

Comments
 (0)