Follow-up: raise paging to 100, case-insensitive .profile, row sub-template, README notes
Earlier commit 7a16ae0 'x' added the first README section for this change; it is kept rather than force-pushing the open PR branch.
This commit is contained in:
parent
6d9dbf40ec
commit
4289b8ac35
18
README.md
18
README.md
@ -187,7 +187,17 @@ https://gitea.seamtro.ai/leora/gitea-selfhost. Run the kit tests (above) first.
|
|||||||
|
|
||||||
## Optional: list `.profile` repos last
|
## Optional: list `.profile` repos last
|
||||||
|
|
||||||
`config/custom/templates/explore/repo_list.tmpl` overrides Gitea 1.23.x's repo list so that
|
`config/custom/templates/explore/repo_list.tmpl` (plus `repo_list_item.tmpl`, the shared row markup)
|
||||||
`.profile` contact-card repos render after the other repos on each page (explore, user and org
|
overrides Gitea 1.23.x's repo list so `.profile` contact-card repos (any case) render after the
|
||||||
pages). Copy it to `$GITEA_CUSTOM/templates/explore/` and restart Gitea. The reorder is per page,
|
other repos. The same list template is used by explore, user and org repo tabs, and the
|
||||||
so it is exact while all repos fit on one page (`[ui] EXPLORE_PAGING_NUM`, default 20).
|
starred / watched views, so they all get this order; admin repo management uses its own template
|
||||||
|
and is unchanged.
|
||||||
|
|
||||||
|
To install, copy both files to `$GITEA_CUSTOM/templates/explore/` and restart Gitea.
|
||||||
|
|
||||||
|
The reorder happens within each page. To keep whole lists in order, `config/app.ini.template`
|
||||||
|
sets `[ui] EXPLORE_PAGING_NUM = 100` and `[ui.user] REPO_PAGING_NUM = 100` (defaults are 20 and 15).
|
||||||
|
If an instance grows past 100 repos, raise these settings.
|
||||||
|
|
||||||
|
On every Gitea upgrade, diff `templates/explore/repo_list.tmpl` in the new version against these
|
||||||
|
files and port any changes. Gitea refuses to start when a template has an error.
|
||||||
|
|||||||
@ -97,3 +97,10 @@ LEVEL = Info
|
|||||||
[other]
|
[other]
|
||||||
SHOW_FOOTER_VERSION = false
|
SHOW_FOOTER_VERSION = false
|
||||||
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
||||||
|
|
||||||
|
; Large pages so the .profile-last template override orders whole lists, not just one page
|
||||||
|
[ui]
|
||||||
|
EXPLORE_PAGING_NUM = 100
|
||||||
|
|
||||||
|
[ui.user]
|
||||||
|
REPO_PAGING_NUM = 100
|
||||||
|
|||||||
@ -1,135 +1,7 @@
|
|||||||
<div class="flex-list">
|
<div class="flex-list">
|
||||||
{{/* seamtro: .profile contact-card repos listed last */}}
|
{{/* seamtro: .profile contact-card repos (any case) listed last; row markup in explore/repo_list_item.tmpl */}}
|
||||||
{{range .Repos}}{{if ne .Name ".profile"}}
|
{{range .Repos}}{{if ne .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}}
|
||||||
<div class="flex-item">
|
{{range .Repos}}{{if eq .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}}
|
||||||
<div class="flex-item-leading">
|
|
||||||
{{template "repo/icon" .}}
|
|
||||||
</div>
|
|
||||||
<div class="flex-item-main">
|
|
||||||
<div class="flex-item-header">
|
|
||||||
<div class="flex-item-title">
|
|
||||||
{{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}}
|
|
||||||
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
|
|
||||||
{{end}}
|
|
||||||
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>
|
|
||||||
<span class="label-list">
|
|
||||||
{{if .IsArchived}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{if .IsPrivate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span>
|
|
||||||
{{else}}
|
|
||||||
{{if .Owner.Visibility.IsPrivate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{if .IsTemplate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{if eq .ObjectFormatName "sha256"}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
|
|
||||||
{{end}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex-item-trailing muted-links">
|
|
||||||
{{if .PrimaryLanguage}}
|
|
||||||
<a class="flex-text-inline" href="?q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}{{if $.TabName}}&tab={{$.TabName}}{{end}}">
|
|
||||||
<i class="color-icon tw-mr-2" style="background-color: {{.PrimaryLanguage.Color}}"></i>
|
|
||||||
{{.PrimaryLanguage.Language}}
|
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
{{if not $.DisableStars}}
|
|
||||||
<a class="flex-text-inline" href="{{.Link}}/stars">
|
|
||||||
<span aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span>
|
|
||||||
<span {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}>{{CountFmt .NumStars}}</span>
|
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
<a class="flex-text-inline" href="{{.Link}}/forks">
|
|
||||||
<span aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span>
|
|
||||||
<span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{$description := .DescriptionHTML ctx}}
|
|
||||||
{{if $description}}
|
|
||||||
<div class="flex-item-body">{{$description}}</div>
|
|
||||||
{{end}}
|
|
||||||
{{if .Topics}}
|
|
||||||
<div class="label-list">
|
|
||||||
{{range .Topics}}
|
|
||||||
{{if ne . ""}}<a class="ui label" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1">{{.}}</a>{{end}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}{{end}}
|
|
||||||
{{range .Repos}}{{if eq .Name ".profile"}}
|
|
||||||
<div class="flex-item">
|
|
||||||
<div class="flex-item-leading">
|
|
||||||
{{template "repo/icon" .}}
|
|
||||||
</div>
|
|
||||||
<div class="flex-item-main">
|
|
||||||
<div class="flex-item-header">
|
|
||||||
<div class="flex-item-title">
|
|
||||||
{{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}}
|
|
||||||
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
|
|
||||||
{{end}}
|
|
||||||
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>
|
|
||||||
<span class="label-list">
|
|
||||||
{{if .IsArchived}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{if .IsPrivate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span>
|
|
||||||
{{else}}
|
|
||||||
{{if .Owner.Visibility.IsPrivate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{if .IsTemplate}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{if eq .ObjectFormatName "sha256"}}
|
|
||||||
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
|
|
||||||
{{end}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex-item-trailing muted-links">
|
|
||||||
{{if .PrimaryLanguage}}
|
|
||||||
<a class="flex-text-inline" href="?q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}{{if $.TabName}}&tab={{$.TabName}}{{end}}">
|
|
||||||
<i class="color-icon tw-mr-2" style="background-color: {{.PrimaryLanguage.Color}}"></i>
|
|
||||||
{{.PrimaryLanguage.Language}}
|
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
{{if not $.DisableStars}}
|
|
||||||
<a class="flex-text-inline" href="{{.Link}}/stars">
|
|
||||||
<span aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span>
|
|
||||||
<span {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}>{{CountFmt .NumStars}}</span>
|
|
||||||
</a>
|
|
||||||
{{end}}
|
|
||||||
<a class="flex-text-inline" href="{{.Link}}/forks">
|
|
||||||
<span aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span>
|
|
||||||
<span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{$description := .DescriptionHTML ctx}}
|
|
||||||
{{if $description}}
|
|
||||||
<div class="flex-item-body">{{$description}}</div>
|
|
||||||
{{end}}
|
|
||||||
{{if .Topics}}
|
|
||||||
<div class="label-list">
|
|
||||||
{{range .Topics}}
|
|
||||||
{{if ne . ""}}<a class="ui label" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1">{{.}}</a>{{end}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}{{end}}
|
|
||||||
{{if not .Repos}}
|
{{if not .Repos}}
|
||||||
<div>
|
<div>
|
||||||
{{ctx.Locale.Tr "search.no_results"}}
|
{{ctx.Locale.Tr "search.no_results"}}
|
||||||
|
|||||||
66
config/custom/templates/explore/repo_list_item.tmpl
Normal file
66
config/custom/templates/explore/repo_list_item.tmpl
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{{/* seamtro: one repo row, from Gitea 1.23.8 explore/repo_list.tmpl. Called with (dict "Repo" <repo> "Root" $) */}}
|
||||||
|
{{with .Repo}}
|
||||||
|
<div class="flex-item">
|
||||||
|
<div class="flex-item-leading">
|
||||||
|
{{template "repo/icon" .}}
|
||||||
|
</div>
|
||||||
|
<div class="flex-item-main">
|
||||||
|
<div class="flex-item-header">
|
||||||
|
<div class="flex-item-title">
|
||||||
|
{{if and (or $.Root.PageIsExplore $.Root.PageIsProfileStarList) .Owner}}
|
||||||
|
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
|
||||||
|
{{end}}
|
||||||
|
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>
|
||||||
|
<span class="label-list">
|
||||||
|
{{if .IsArchived}}
|
||||||
|
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if .IsPrivate}}
|
||||||
|
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span>
|
||||||
|
{{else}}
|
||||||
|
{{if .Owner.Visibility.IsPrivate}}
|
||||||
|
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if .IsTemplate}}
|
||||||
|
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if eq .ObjectFormatName "sha256"}}
|
||||||
|
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
|
||||||
|
{{end}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex-item-trailing muted-links">
|
||||||
|
{{if .PrimaryLanguage}}
|
||||||
|
<a class="flex-text-inline" href="?q={{$.Root.Keyword}}&sort={{$.Root.SortType}}&language={{.PrimaryLanguage.Language}}{{if $.Root.TabName}}&tab={{$.Root.TabName}}{{end}}">
|
||||||
|
<i class="color-icon tw-mr-2" style="background-color: {{.PrimaryLanguage.Color}}"></i>
|
||||||
|
{{.PrimaryLanguage.Language}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
{{if not $.Root.DisableStars}}
|
||||||
|
<a class="flex-text-inline" href="{{.Link}}/stars">
|
||||||
|
<span aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span>
|
||||||
|
<span {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}>{{CountFmt .NumStars}}</span>
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
<a class="flex-text-inline" href="{{.Link}}/forks">
|
||||||
|
<span aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span>
|
||||||
|
<span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{$description := .DescriptionHTML ctx}}
|
||||||
|
{{if $description}}
|
||||||
|
<div class="flex-item-body">{{$description}}</div>
|
||||||
|
{{end}}
|
||||||
|
{{if .Topics}}
|
||||||
|
<div class="label-list">
|
||||||
|
{{range .Topics}}
|
||||||
|
{{if ne . ""}}<a class="ui label" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1">{{.}}</a>{{end}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
Loading…
x
Reference in New Issue
Block a user