2016-08-11 19:07:09 -05:00
|
|
|
<div id="file-content" class="{{TabSizeClass .Editorconfig .FileName}}">
|
2015-12-07 16:30:52 -06:00
|
|
|
<h4 class="ui top attached header" id="{{if .ReadmeExist}}repo-readme{{else}}repo-read-file{{end}}">
|
|
|
|
{{if .ReadmeExist}}
|
|
|
|
<i class="book icon ui left"></i>
|
|
|
|
{{if .ReadmeInList}}
|
|
|
|
<strong>{{.FileName}}</strong>
|
|
|
|
{{else}}
|
|
|
|
<strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
|
|
|
<i class="file text outline icon ui left"></i>
|
|
|
|
<strong>{{.FileName}}</strong> <span class="text grey normal">{{FileSize .FileSize}}</span>
|
|
|
|
{{end}}
|
|
|
|
{{if not .ReadmeInList}}
|
2016-08-11 07:48:08 -05:00
|
|
|
<div class="ui right file-actions">
|
|
|
|
<div class="ui buttons">
|
2015-12-08 23:32:53 -06:00
|
|
|
{{if not .IsViewCommit}}
|
2016-08-27 17:25:01 -05:00
|
|
|
<a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_permalink"}}</a>
|
2015-12-07 16:30:52 -06:00
|
|
|
{{end}}
|
2016-08-27 17:25:01 -05:00
|
|
|
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
|
2015-12-07 16:30:52 -06:00
|
|
|
<a class="ui button" href="{{EscapePound .FileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
|
|
|
|
</div>
|
2016-08-27 17:25:01 -05:00
|
|
|
{{if .CanEditFile}}
|
2016-08-28 03:41:44 -05:00
|
|
|
<a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-pencil btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
|
2016-08-11 07:48:08 -05:00
|
|
|
{{else}}
|
2016-08-28 03:41:44 -05:00
|
|
|
<i class="octicon octicon-pencil btn-octicon poping up disabled" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
|
2016-08-11 07:48:08 -05:00
|
|
|
{{end}}
|
2016-08-27 17:25:01 -05:00
|
|
|
{{if .CanDeleteFile}}
|
2016-08-28 03:41:44 -05:00
|
|
|
<a href="{{.RepoLink}}/_delete/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-trashcan btn-octicon btn-octicon-danger poping up" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
|
2016-08-11 07:48:08 -05:00
|
|
|
{{else}}
|
2016-08-28 03:41:44 -05:00
|
|
|
<i class="octicon octicon-trashcan btn-octicon poping up disabled" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
|
2016-08-11 07:48:08 -05:00
|
|
|
{{end}}
|
2015-12-07 16:30:52 -06:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</h4>
|
|
|
|
<div class="ui attached table segment">
|
2016-08-11 07:48:08 -05:00
|
|
|
<div class="file-view {{if .IsMarkdown}}markdown{{else if .IsFileText}}code-view{{end}} has-emoji">
|
|
|
|
{{if .IsMarkdown}}
|
2015-12-07 16:30:52 -06:00
|
|
|
{{if .FileContent}}{{.FileContent | Str2html}}{{end}}
|
|
|
|
{{else if not .IsFileText}}
|
2015-12-25 04:45:07 -06:00
|
|
|
<div class="view-raw ui center">
|
2015-12-07 16:30:52 -06:00
|
|
|
{{if .IsImageFile}}
|
|
|
|
<img src="{{EscapePound .FileLink}}">
|
2016-04-26 20:48:44 -05:00
|
|
|
{{else if .IsPDFFile}}
|
|
|
|
<iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound .FileLink}}"></iframe>
|
2015-12-07 16:30:52 -06:00
|
|
|
{{else}}
|
2016-08-11 07:48:08 -05:00
|
|
|
<a href="{{EscapePound $.FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
|
2015-12-07 16:30:52 -06:00
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
{{else if .FileSize}}
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2016-07-11 17:21:26 -05:00
|
|
|
{{if .IsFileTooLarge}}
|
|
|
|
<td><strong>{{.i18n.Tr "repo.file_too_large"}}</strong></td>
|
|
|
|
{{else}}
|
2016-08-09 14:35:20 -05:00
|
|
|
<td class="lines-num">{{.LineNums}}</td>
|
2015-12-16 21:13:12 -06:00
|
|
|
<td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
|
2016-07-11 17:21:26 -05:00
|
|
|
{{end}}
|
2015-12-07 16:30:52 -06:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-08-11 07:48:08 -05:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function submitDeleteForm() {
|
|
|
|
var message = prompt("{{.i18n.Tr "repo.delete_confirm_message"}}\n\n{{.i18n.Tr "repo.delete_commit_summary"}}", "Delete '{{.TreeName}}'");
|
|
|
|
if (message != null) {
|
|
|
|
$("#delete-message").val(message);
|
|
|
|
$("#delete-file-form").submit()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|