You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.0 KiB

  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}} has-emoji">
  28. {{if .ReadmeExist}}
  29. {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
  30. {{else if not .IsFileText}}
  31. <div class="view-raw ui center">
  32. {{if .IsImageFile}}
  33. <img src="{{EscapePound .FileLink}}">
  34. {{else if .IsPDFFile}}
  35. <iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound .FileLink}}"></iframe>
  36. {{else}}
  37. <a href="{{EscapePound .FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
  38. {{end}}
  39. </div>
  40. {{else if .FileSize}}
  41. <table>
  42. <tbody>
  43. <tr>
  44. <td class="lines-num"></td>
  45. <td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. {{end}}
  50. </div>
  51. </div>
  52. </div>