Merge branch 'add-file-tree-to-file-view-page' of github.com:kerwin612/gitea into kerwin612-add-file-tree-to-file-view-page

This commit is contained in:
Lunny Xiao
2025-01-02 23:52:22 -08:00
6 changed files with 50 additions and 28 deletions
+9 -2
View File
@@ -96,9 +96,16 @@ func RefBlame(ctx *context.Context) {
ctx.Data["FileSize"] = fileSize
ctx.Data["FileName"] = blob.Name()
var tplName templates.TplName
if ctx.FormBool("only_content") {
tplName = tplRepoHomeContent
} else {
tplName = tplRepoHome
}
if fileSize >= setting.UI.MaxDisplayFileSize {
ctx.Data["IsFileTooLarge"] = true
ctx.HTML(http.StatusOK, tplRepoHome)
ctx.HTML(http.StatusOK, tplName)
return
}
@@ -126,7 +133,7 @@ func RefBlame(ctx *context.Context) {
renderBlame(ctx, result.Parts, commitNames)
ctx.HTML(http.StatusOK, tplRepoHome)
ctx.HTML(http.StatusOK, tplName)
}
type blameResult struct {
+7 -6
View File
@@ -46,12 +46,13 @@ import (
)
const (
tplRepoEMPTY templates.TplName = "repo/empty"
tplRepoHome templates.TplName = "repo/home"
tplRepoViewList templates.TplName = "repo/view_list"
tplWatchers templates.TplName = "repo/watchers"
tplForks templates.TplName = "repo/forks"
tplMigrating templates.TplName = "repo/migrate/migrating"
tplRepoEMPTY templates.TplName = "repo/empty"
tplRepoHome templates.TplName = "repo/home"
tplRepoHomeContent templates.TplName = "repo/home_content"
tplRepoViewList templates.TplName = "repo/view_list"
tplWatchers templates.TplName = "repo/watchers"
tplForks templates.TplName = "repo/forks"
tplMigrating templates.TplName = "repo/migrate/migrating"
)
type fileInfo struct {
+5 -1
View File
@@ -379,5 +379,9 @@ func Home(ctx *context.Context) {
}
}
ctx.HTML(http.StatusOK, tplRepoHome)
if ctx.FormBool("only_content") {
ctx.HTML(http.StatusOK, tplRepoHomeContent)
} else {
ctx.HTML(http.StatusOK, tplRepoHome)
}
}