mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 05:42:43 +01:00
ffddf3f8a6
Now defaults to 16 on both frontend and backend. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
124 lines
5 KiB
Cheetah
124 lines
5 KiB
Cheetah
<div class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content">
|
|
<h4 class="file-header ui top attached header">
|
|
<div class="file-header-left df ac">
|
|
{{if .ReadmeInList}}
|
|
{{svg "octicon-book" 16 "mr-3"}}
|
|
<strong>{{.FileName}}</strong>
|
|
{{else}}
|
|
<div class="file-info text grey normal mono">
|
|
{{if .FileIsSymlink}}
|
|
<div class="file-info-entry">
|
|
{{.i18n.Tr "repo.symbolic_link"}}
|
|
</div>
|
|
{{end}}
|
|
{{if .NumLinesSet}}
|
|
<div class="file-info-entry">
|
|
{{.NumLines}} {{.i18n.Tr (TrN .i18n.Lang .NumLines "repo.line" "repo.lines") }}
|
|
</div>
|
|
{{end}}
|
|
{{if .FileSize}}
|
|
<div class="file-info-entry">
|
|
{{FileSize .FileSize}}{{if .IsLFSFile}} ({{.i18n.Tr "repo.stored_lfs"}}){{end}}
|
|
</div>
|
|
{{end}}
|
|
{{if .LFSLock}}
|
|
<div class="file-info-entry ui" data-tooltip="{{.LFSLockHint}}" data-inverted="">
|
|
{{svg "octicon-lock" 16 "mr-2"}}
|
|
<a href="{{AppSubUrl}}/{{.LFSLock.Owner.Name}}">{{.LFSLockOwner}}</a>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{if not .ReadmeInList}}
|
|
<div class="file-header-right df ac">
|
|
<div class="ui right file-actions">
|
|
<div class="ui buttons">
|
|
<a class="ui button" href="{{EscapePound $.RawFileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
|
|
{{if not .IsViewCommit}}
|
|
<a class="ui button" href="{{.RepoLink}}/src/commit/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_permalink"}}</a>
|
|
{{end}}
|
|
{{if .IsTextFile}}
|
|
<a class="ui button" href="{{.RepoLink}}/blame/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.blame"}}</a>
|
|
{{end}}
|
|
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
|
|
</div>
|
|
{{if .Repository.CanEnableEditor}}
|
|
{{if .CanEditFile}}
|
|
<a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><span class="btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-pencil"}}</span></a>
|
|
{{else}}
|
|
<span class="btn-octicon poping up disabled" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-pencil"}}</span>
|
|
{{end}}
|
|
{{if .CanDeleteFile}}
|
|
<a href="{{.RepoLink}}/_delete/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><span class="btn-octicon btn-octicon-danger poping up" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-trashcan"}}</span></a>
|
|
{{else}}
|
|
<span class="btn-octicon poping up disabled" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-trashcan"}}</span>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</h4>
|
|
<div class="ui attached table unstackable segment">
|
|
<div class="file-view {{if .IsMarkup}}{{.MarkupType}} markdown{{else if .IsRenderedHTML}}plain-text{{else if .IsTextFile}}code-view{{end}}">
|
|
{{if .IsMarkup}}
|
|
{{if .FileContent}}{{.FileContent | Safe}}{{end}}
|
|
{{else if .IsRenderedHTML}}
|
|
<pre>{{if .FileContent}}{{.FileContent | Str2html}}{{end}}</pre>
|
|
{{else if not .IsTextFile}}
|
|
<div class="view-raw ui center">
|
|
{{if .IsImageFile}}
|
|
<img src="{{EscapePound $.RawFileLink}}">
|
|
{{else if .IsVideoFile}}
|
|
<video controls src="{{EscapePound $.RawFileLink}}">
|
|
<strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong>
|
|
</video>
|
|
{{else if .IsAudioFile}}
|
|
<audio controls src="{{EscapePound $.RawFileLink}}">
|
|
<strong>{{.i18n.Tr "repo.audio_not_supported_in_browser"}}</strong>
|
|
</audio>
|
|
{{else if .IsPDFFile}}
|
|
<iframe width="100%" height="600px" src="{{StaticUrlPrefix}}/vendor/plugins/pdfjs/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
|
|
{{else}}
|
|
<a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
|
|
{{end}}
|
|
</div>
|
|
{{else if .FileSize}}
|
|
{{if .IsFileTooLarge}}
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td><strong>{{.i18n.Tr "repo.file_too_large"}}</strong></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
{{else}}
|
|
<table>
|
|
<tbody>
|
|
{{range $line, $code := .FileContent}}
|
|
<tr>
|
|
<td id="L{{$line}}" class="lines-num">
|
|
<span id="L{{$line}}" data-line-number="{{$line}}"></span>
|
|
</td>
|
|
<td rel="L{{$line}}" class="lines-code chroma">
|
|
<code>{{$code | Safe}}</code>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<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>
|