single.tmpl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {{template "base/head" .}}
  2. {{template "base/navbar" .}}
  3. {{template "repo/nav" .}}
  4. {{template "repo/toolbar" .}}
  5. <div id="gogs-body" class="container">
  6. <div id="gogs-source">
  7. {{if .IsBareRepo}}
  8. Need to fill in some guide.
  9. {{else}}
  10. <div class="source-toolbar">
  11. {{ $username := .Username}}
  12. {{ $reponame := .Reponame}}
  13. {{ $branchname := .Branchname}}
  14. {{ $treenames := .Treenames}}
  15. {{ $repoLink := .RepositoryLink}}
  16. {{ $n := len $treenames}}
  17. <button class="btn btn-default pull-right"><i class="fa fa-plus-square"></i>Add File</button>
  18. <div class="dropdown branch-switch">
  19. <a href="#" class="btn btn-success dropdown-toggle" data-toggle="dropdown"><i class="fa fa-chain"></i>{{$branchname}}&nbsp;&nbsp;
  20. <b class="caret"></b></a>
  21. <ul class="dropdown-menu">
  22. {{range .Branches}}
  23. <li><a {{if eq . $branchname}}class="current" {{end}}href="/{{$repoLink}}/tree/{{.}}">{{.}}</a></li>
  24. {{end}}
  25. </ul>
  26. </div>
  27. {{$paths := .Paths}}
  28. {{ $l := Subtract $n 1}}
  29. <ol class="breadcrumb">
  30. <li class="root dir">
  31. <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}">{{.Repository.Name}}</a></li>
  32. {{range $i, $v := $treenames}}
  33. <li class="dir">
  34. {{if eq $i $l}}{{$v}}
  35. {{else}}
  36. <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}/{{index $paths $i}}">{{$v}}</a>&nbsp;
  37. {{end}}
  38. </li>
  39. {{end}}
  40. </ol>
  41. </div>
  42. <div class="panel panel-default info-box">
  43. <div class="panel-heading info-head">
  44. <a href="/{{$username}}/{{$reponame}}/commit/{{.LastCommit.Oid.String}}">{{.LastCommit.Message}}</a>
  45. </div>
  46. <div class="panel-body info-content">
  47. <a href="/user/{{.LastCommit.Author.Name}}">{{.LastCommit.Author.Name}}</a> <span class="text-muted">{{TimeSince .LastCommit.Author.When}}</span>
  48. </div>
  49. <table class="panel-footer table file-list">
  50. <thead class="hidden">
  51. <tr>
  52. <th class="icon"></th>
  53. <th class="name">Filename</th>
  54. <th class="text">Message</th>
  55. <th class="date">Date modified</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. {{if .HasParentPath}}
  60. <tr class="has-parent">
  61. <td class="icon"><a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}{{.ParentPath}}"><i class="fa fa-reply"></i></a></td>
  62. <td class="name"><a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}{{.ParentPath}}">..</a></td>
  63. <td class="text"></td>
  64. <td class="date"></td>
  65. </tr>
  66. {{end}}
  67. {{range .Files}}
  68. <tr
  69. {{if .IsDir}}class="is-dir"{{end}}>
  70. <td class="icon">
  71. <i class="fa {{if .IsDir}}fa-folder{{else}}fa-file-text-o{{end}}"></i>
  72. </td>
  73. <td class="name">
  74. <span class="wrap">
  75. {{if .IsDir}}
  76. <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}/{{.Path}}">{{.Name}}</a>
  77. {{else}}
  78. <a href="/{{$username}}/{{$reponame}}/blob/{{$branchname}}/{{.Name}}">{{.Name}}</a>
  79. {{end}}
  80. </span>
  81. </td>
  82. <td class="text">
  83. <span class="wrap"><a href="/{{$username}}/{{$reponame}}/commit/{{.Commit.Oid}}">{{.Commit.Message}}</a></span>
  84. </td>
  85. <td class="date">
  86. <span class="wrap">{{TimeSince .Commit.Committer.When}}</span>
  87. </td>
  88. </tr>
  89. {{end}}
  90. </tbody>
  91. </table>
  92. </div>
  93. {{if .ReadmeExist}}
  94. <div class="panel panel-default file-content">
  95. <div class="panel-heading file-head">
  96. <i class="icon fa fa-book"></i> README.md
  97. </div>
  98. {{if .FileIsLarge}}
  99. <div class="panel-footer">
  100. Large file size 1000kb
  101. </div>
  102. {{else}}
  103. <div class="panel-body file-body markdown">
  104. {{.ReadmeContent|str2html}}
  105. </div>
  106. {{end}}
  107. </div>
  108. {{end}}
  109. {{end}}
  110. </div>
  111. </div>
  112. {{template "base/footer" .}}