aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2025-05-04 14:07:29 -0700
committerGitHub <noreply@github.com>2025-05-05 00:07:29 +0300
commit62f73491f36eff06ab42bca4aa66f2fc9dfc673d (patch)
tree4762994c145542708d7530c06c9c12ead094a727
parent51aafb427802803e9a97806afed07f488e032d83 (diff)
downloadgitea-62f73491f36eff06ab42bca4aa66f2fc9dfc673d.tar.gz
gitea-62f73491f36eff06ab42bca4aa66f2fc9dfc673d.zip
Use lfs label for lfs file rather than a long description (#34363)
Before ![image](https://github.com/user-attachments/assets/ed6c9221-5a6a-4717-8178-e5528fd180bf) After ![image](https://github.com/user-attachments/assets/baa94350-ead4-46bf-b4b7-1bfd3aa5dcac)
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--templates/repo/diff/box.tmpl2
-rw-r--r--templates/repo/file_info.tmpl2
-rw-r--r--tests/integration/lfs_view_test.go6
4 files changed, 5 insertions, 6 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index a8fabc9ca1..4db4964afb 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1305,7 +1305,6 @@ file_copy_permalink = Copy Permalink
view_git_blame = View Git Blame
video_not_supported_in_browser = Your browser does not support the HTML5 'video' tag.
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
vendored = Vendored
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index f8d0804bf0..fa96d2f0e2 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -101,8 +101,8 @@
{{end}}
</div>
<span class="file tw-flex tw-items-center tw-font-mono tw-flex-1"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a>
- {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
<button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button>
+ {{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
{{if $file.IsGenerated}}
<span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span>
{{end}}
diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl
index b63af68973..38133bde2b 100644
--- a/templates/repo/file_info.tmpl
+++ b/templates/repo/file_info.tmpl
@@ -11,7 +11,7 @@
{{end}}
{{if ne .FileSize nil}}
<div class="file-info-entry">
- {{FileSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
+ {{FileSize .FileSize}}{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
</div>
{{end}}
{{if .LFSLock}}
diff --git a/tests/integration/lfs_view_test.go b/tests/integration/lfs_view_test.go
index 153050dd5e..64ffebaa78 100644
--- a/tests/integration/lfs_view_test.go
+++ b/tests/integration/lfs_view_test.go
@@ -38,7 +38,7 @@ func TestLFSRender(t *testing.T) {
doc := NewHTMLParser(t, resp.Body).doc
fileInfo := doc.Find("div.file-info-entry").First().Text()
- assert.Contains(t, fileInfo, "Stored with Git LFS")
+ assert.Contains(t, fileInfo, "LFS")
content := doc.Find("div.file-view").Text()
assert.Contains(t, content, "Testing documents in LFS")
@@ -54,7 +54,7 @@ func TestLFSRender(t *testing.T) {
doc := NewHTMLParser(t, resp.Body).doc
fileInfo := doc.Find("div.file-info-entry").First().Text()
- assert.Contains(t, fileInfo, "Stored with Git LFS")
+ assert.Contains(t, fileInfo, "LFS")
src, exists := doc.Find(".file-view img").Attr("src")
assert.True(t, exists, "The image should be in an <img> tag")
@@ -71,7 +71,7 @@ func TestLFSRender(t *testing.T) {
doc := NewHTMLParser(t, resp.Body).doc
fileInfo := doc.Find("div.file-info-entry").First().Text()
- assert.Contains(t, fileInfo, "Stored with Git LFS")
+ assert.Contains(t, fileInfo, "LFS")
rawLink, exists := doc.Find("div.file-view > div.view-raw > a").Attr("href")
assert.True(t, exists, "Download link should render instead of content because this is a binary file")