view_file.tmpl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <div id="file-content">
  2. <h4 class="ui top attached header" id="{{if .ReadmeExist}}repo-readme{{else}}repo-read-file{{end}}">
  3. {{if .ReadmeExist}}
  4. <i class="book icon ui left"></i>
  5. {{if .ReadmeInList}}
  6. <strong>{{.FileName}}</strong>
  7. {{else}}
  8. <strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
  9. {{end}}
  10. {{else}}
  11. <i class="file text outline icon ui left"></i>
  12. <strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
  13. {{end}}
  14. {{if not .ReadmeInList}}
  15. <div class="ui right">
  16. <div class="ui small grey basic buttons">
  17. {{if not .IsViewCommit}}
  18. <a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_permalink"}}</a>
  19. {{end}}
  20. <a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_history"}}</a>
  21. <a class="ui button" href="{{EscapePound .FileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
  22. </div>
  23. </div>
  24. {{end}}
  25. </h4>
  26. <div class="ui attached table segment">
  27. <div class="file-view {{if .ReadmeExist}}markdown{{else if .IsFileText}}code-view{{end}}">
  28. {{if .ReadmeExist}}
  29. {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
  30. {{else if not .IsFileText}}
  31. <div class="view-raw">
  32. {{if .IsImageFile}}
  33. <img src="{{EscapePound .FileLink}}">
  34. {{else}}
  35. <a href="{{EscapePound .FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
  36. {{end}}
  37. </div>
  38. {{else if .FileSize}}
  39. <table>
  40. <tbody>
  41. <tr>
  42. <td class="lines-num"></td>
  43. <td class="lines-code"><pre class="{{if .FileExt}}lang-{{.FileExt}}{{end}}"><code><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. {{end}}
  48. </div>
  49. </div>
  50. </div>