view_file.tmpl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <div class="panel panel-radius" id="{{if .ReadmeExist}}repo-readme{{else}}repo-read-file{{end}}">
  2. <p class="panel-header">
  3. {{if .ReadmeExist}}
  4. <i class="icon fa fa-book fa-lg"></i>
  5. {{if .ReadmeInList}}
  6. <strong class="file-name">{{.FileName}}</strong>
  7. {{else}}
  8. <strong>{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
  9. {{end}}
  10. {{else}}
  11. <i class="icon fa fa-file-text-o"></i>
  12. <strong class="file-name">{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
  13. {{end}}
  14. {{if not .ReadmeInList}}
  15. <a class="right" href="{{.RepoLink}}/commits/{{.BranchName}}/{{.TreeName}}">
  16. <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
  17. </a>
  18. <a class="right" href="{{.FileLink}}">
  19. <button class="btn btn-medium btn-gray btn-left-radius btn-comb">{{.i18n.Tr "repo.file_raw"}}</button>
  20. </a>
  21. {{end}}
  22. </p>
  23. <div class="{{if .ReadmeExist}}panel-content markdown{{end}} code-view" id="repo-code-view">
  24. {{if .ReadmeExist}}
  25. {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
  26. {{else if not .IsFileText}}
  27. <div class="view-raw">
  28. {{if .IsImageFile}}
  29. <img src="{{.FileLink}}">
  30. {{else}}
  31. <a href="{{.FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
  32. {{end}}
  33. </div>
  34. {{else if .FileSize}}
  35. <table>
  36. <tbody>
  37. <tr>
  38. <td class="lines-num"></td>
  39. <td class="lines-code"><pre class="prettyprint linenums {{if .FileExt}}lang-{{.FileExt}}{{end}}"><code>{{.FileContent}}</code></pre></td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. {{end}}
  44. </div>
  45. </div>