@cryptotaxi247 / kubo / commits / 51e423e4a

Add CID column

Kevin Neaton committed Jul 3, 2020 at 00:53 UTC 51e423e4a6f82507d43dbbc9f8f2f322dea912ed
2 files changed +25
dir-index.html
+22
@@ -33,6 +33,17 @@
33 .ml-auto {
34 margin-left: auto;
35 }
36 + .text-truncate {
37 + overflow: hidden;
38 + text-overflow: ellipsis;
39 + white-space: nowrap;
40 + }
41 + .table-responsive {
42 + display: block;
43 + width: 100%;
44 + overflow-x: auto;
45 + -webkit-overflow-scrolling: touch;
46 + }
47 </style>
48
49 <title>{{ .Path }}</title>
@@ -75,6 +86,7 @@
86 </div>
87 {{ end }}
88 </div>
89 + <div class="table-responsive">
90 <table>
91 <tr>
92 <td class="type-icon">
@@ -84,6 +96,7 @@
96 <a href="{{.BackLink | urlEscape}}">..</a>
97 </td>
98 <td></td>
99 + <td></td>
100 </tr>
101 {{ range .Listing }}
102 <tr>
@@ -93,10 +106,19 @@
106 <td>
107 <a href="{{ .Path | urlEscape }}">{{ .Name }}</a>
108 </td>
109 + <td>
110 + {{ if .Hash }}
111 + <a class="d-flex" style="width:33vw; max-width:30em; max-width: max-content" href="/ipfs/{{ .Hash | urlEscape }}">
112 + <span class="text-truncate" style="min-width: 2.5em">{{ slice .Hash 0 40 }}</span>
113 + <span class="no-linebreak">{{ slice .Hash 40 }}</span>
114 + </a>
115 + {{ end }}
116 + </td>
117 <td class="no-linebreak">{{ .Size }}</td>
118 </tr>
119 {{ end }}
120 </table>
121 + </div>
122 </div>
123 </body>
124 </html>
test/main.go
+3
@@ -24,6 +24,7 @@ type directoryItem struct {
24 Size string
25 Name string
26 Path string
27 + Hash string
28 }
29
30 type breadcrumb struct {
@@ -37,10 +38,12 @@ var testData = listingTemplateData{
38 Size: "25 MiB",
39 Name: "short-film.mov",
40 Path: testPath + "/short-film.mov",
41 + Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7",
42 }, {
43 Size: "1 KiB",
44 Name: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt",
45 Path: testPath + "/this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt",
46 + Hash: "QmquXbaRQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7",
47 }},
48 Size: "25 MiB",
49 Path: testPath,