template.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package main
  2. import "html/template"
  3. const index = `
  4. {{define "index"}}
  5. <!DOCTYPE html>
  6. <html lang="en">
  7. <head>
  8. <meta charset="UTF-8">
  9. <title>{{.Title}}</title>
  10. <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
  11. <link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
  12. <link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
  13. </head>
  14. <body>
  15. <div class="container">
  16. <h2>{{.Title}}</h2>
  17. {{if .Error}}
  18. <p>Error {{.Error}}</p>
  19. {{else}}
  20. <hr>
  21. <table>
  22. <thead>
  23. <tr>
  24. <th>Name</th>
  25. <th>Size</th>
  26. <th>Date</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. {{range .Items}}{{ if .Valid}}
  31. <tr>
  32. <td><a href="{{.URL}}?tarball=1" class="pure-menu-link">{{.Name}}</a></td>
  33. <td>{{.FSize}}</td>
  34. <td>{{.FDate}}</td>
  35. </tr>
  36. {{end}}{{end}}
  37. </tbody>
  38. </table>
  39. {{end}}
  40. <hr>
  41. </div>
  42. </body>
  43. </html>
  44. {{end}}
  45. `
  46. var tmpl *template.Template