From b1f0cecbf0de4a4feddb835d431b5ee3341ef29c Mon Sep 17 00:00:00 2001 From: JakobDev Date: Thu, 15 Jun 2023 14:28:26 +0200 Subject: [PATCH 1/2] Show if File is Executable --- options/locale/locale_en-US.ini | 1 + routers/web/repo/view.go | 1 + templates/repo/file_info.tmpl | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 65dda101f5b50..25456d0493426 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1156,6 +1156,7 @@ video_not_supported_in_browser = Your browser does not support the HTML5 'video' audio_not_supported_in_browser = Your browser does not support the HTML5 'audio' tag. stored_lfs = Stored with Git LFS symbolic_link = Symbolic link +executable_file = Executable File commit_graph = Commit Graph commit_graph.select = Select branches commit_graph.hide_pr_refs = Hide Pull Requests diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index cf719c49f0b29..ad87bae9b8fa0 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -390,6 +390,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st ctx.Data["IsRepresentableAsText"] = isRepresentableAsText ctx.Data["IsDisplayingSource"] = isDisplayingSource ctx.Data["IsDisplayingRendered"] = isDisplayingRendered + ctx.Data["IsExecutable"] = entry.IsExecutable() isTextSource := fInfo.isTextFile || isDisplayingSource ctx.Data["IsTextSource"] = isTextSource diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl index 580966d35c051..3c9191672307e 100644 --- a/templates/repo/file_info.tmpl +++ b/templates/repo/file_info.tmpl @@ -20,6 +20,11 @@ {{.LFSLockOwner}} {{end}} + {{if .IsExecutable}} +
+ {{.locale.Tr "repo.executable_file"}} +
+ {{end}} {{if .LexerName}}
{{.LexerName}} From b51f17a67e95d5e6271535db1c924f4e2ff2ac54 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 15 Jun 2023 19:44:19 +0200 Subject: [PATCH 2/2] move to end --- templates/repo/file_info.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl index 3c9191672307e..44256a0dcb21c 100644 --- a/templates/repo/file_info.tmpl +++ b/templates/repo/file_info.tmpl @@ -20,14 +20,14 @@ {{.LFSLockOwner}}
{{end}} - {{if .IsExecutable}} + {{if .LexerName}}
- {{.locale.Tr "repo.executable_file"}} + {{.LexerName}}
{{end}} - {{if .LexerName}} + {{if .IsExecutable}}
- {{.LexerName}} + {{.locale.Tr "repo.executable_file"}}
{{end}}