view_file.tmpl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. {{if not .IsCommit}}
  16. <a class="right" href="{{.RepoLink}}/src/{{.CommitId}}/{{EscapePound .TreeName}}">
  17. <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_permalink"}}</button>
  18. </a>
  19. {{end}}
  20. <a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreeName}}">
  21. <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
  22. </a>
  23. <a class="right" href="{{EscapePound .FileLink}}">
  24. <button class="btn btn-medium btn-gray btn-left-radius btn-comb">{{.i18n.Tr "repo.file_raw"}}</button>
  25. </a>
  26. {{end}}
  27. </p>
  28. <div class="{{if .ReadmeExist}}panel-content markdown{{end}} code-view" id="repo-code-view">
  29. {{if .ReadmeExist}}
  30. {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
  31. {{else if not .IsFileText}}
  32. <div class="view-raw">
  33. {{if .IsImageFile}}
  34. <img src="{{EscapePound .FileLink}}">
  35. {{else}}
  36. <a href="{{EscapePound .FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
  37. {{end}}
  38. </div>
  39. {{else if .FileSize}}
  40. <table>
  41. <tbody>
  42. <tr>
  43. <td class="lines-num"></td>
  44. <td class="lines-code"><pre class="prettyprint linenums {{if .FileExt}}lang-{{.FileExt}}{{end}}"><code>{{.FileContent}}</code></pre></td>
  45. </tr>
  46. </tbody>
  47. </table>
  48. {{end}}
  49. </div>
  50. </div>