From e5422db5c76411780fb218f058ad1a689c876f7a Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 16 Jun 2023 05:29:26 -0400 Subject: [PATCH] Show if File is Executable (#25287) (#25300) Backport #25287 by @JakobDev This simply shows if a File has the executable Permission ![grafik](https://github.com/go-gitea/gitea/assets/15185051/1d50c105-6d55-4ecc-808a-c9cd5559d238) Co-authored-by: JakobDev Co-authored-by: silverwind --- 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 41f2cb3b5b5..788582db952 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 2fd893f91c6..59d15583eba 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -382,6 +382,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 580966d35c0..44256a0dcb2 100644 --- a/templates/repo/file_info.tmpl +++ b/templates/repo/file_info.tmpl @@ -25,4 +25,9 @@ {{.LexerName}} {{end}} + {{if .IsExecutable}} +
+ {{.locale.Tr "repo.executable_file"}} +
+ {{end}}