forgejo/templates/repo/file_info.tmpl
Gusted 69dfe81d0e [UI] Adjust trailing EOL behavior for empty file
- Follow up #4835
- Currently for empty files (file size is shown in the file header) the
"No EOL" information is being shown, even though it doesn't really
make sense to show that for empty files.
- Add integration test.
- Ref: https://codeberg.org/Codeberg/Community/issues/1612#issuecomment-2169437

(cherry picked from commit e9a89a188e)
2024-08-20 13:42:33 +00:00

53 lines
1.4 KiB
Go HTML Template

<div class="file-info tw-font-mono">
{{if .FileIsSymlink}}
<div class="file-info-entry">
{{ctx.Locale.Tr "repo.symbolic_link"}}
</div>
{{end}}
{{if .NumLinesSet}}{{/* Explicit attribute needed to show 0 line changes */}}
<div class="file-info-entry">
{{.NumLines}} {{ctx.Locale.TrN .NumLines "repo.line" "repo.lines"}}
</div>
{{end}}
{{if .HasNoTrailingEOL}}
<div class="file-info-entry" data-tooltip-content="{{ctx.Locale.Tr "repo.no_eol.tooltip"}}">
{{ctx.Locale.Tr "repo.no_eol.text"}}
</div>
{{end}}
{{if .FileSize}}
<div class="file-info-entry">
{{ctx.Locale.TrSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
</div>
{{end}}
{{if .LFSLock}}
<div class="file-info-entry ui" data-tooltip-content="{{.LFSLockHint}}">
{{svg "octicon-lock" 16 "tw-mr-1"}}
<a href="{{.LFSLockOwnerHomeLink}}">{{.LFSLockOwner}}</a>
</div>
{{end}}
{{if .LexerName}}
<div class="file-info-entry">
{{.LexerName}}
</div>
{{end}}
{{if .IsExecutable}}
<div class="file-info-entry">
{{ctx.Locale.Tr "repo.executable_file"}}
</div>
{{end}}
{{if .IsVendored}}
<div class="file-info-entry">
{{ctx.Locale.Tr "repo.vendored"}}
</div>
{{end}}
{{if .IsGenerated}}
<div class="file-info-entry">
{{ctx.Locale.Tr "repo.generated"}}
</div>
{{end}}
{{if .ImageSize}}
<div class="file-info-entry">
{{.ImageSize}}
</div>
{{end}}
</div>