From 863eb41a1da537503ab7c19f6abe8f3799442d96 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH] forgejo/templates: rename issues and pull requests Doing le funny --- modules/services/forgejo/module.nix | 6 +- .../forgejo/templates/repo/header.tmpl | 202 ++++++++++++++++++ 2 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 modules/services/forgejo/templates/repo/header.tmpl diff --git a/modules/services/forgejo/module.nix b/modules/services/forgejo/module.nix index 155c355..a09f987 100644 --- a/modules/services/forgejo/module.nix +++ b/modules/services/forgejo/module.nix @@ -169,9 +169,11 @@ in { "L+ '${customDir}/public/assets/css/codeberg/dark-variables.css' - - - - ${dark-variables}" # Templates - "d '${customDir}/templates ' 0750 ${user} ${group} - -" + "d '${customDir}/templates' 0750 ${user} ${group} - -" + "d '${customDir}/templates/repo' 0750 ${user} ${group} - -" # Home page - "L+ '${customDir}/templates' - - - - ${./templates}" + "L+ '${customDir}/templates/home.tmpl' - - - - ${./templates}/home.tmpl" + "L+ '${customDir}/templates/repo/header.tmpl' - - - - ${./templates/repo}/header.tmpl" # Fuck off scrapers "L+ ${customDir}/public/robots.txt - - - - ${robots.outPath}" diff --git a/modules/services/forgejo/templates/repo/header.tmpl b/modules/services/forgejo/templates/repo/header.tmpl new file mode 100644 index 0000000..893098d --- /dev/null +++ b/modules/services/forgejo/templates/repo/header.tmpl @@ -0,0 +1,202 @@ + +
+{{with .Repository}} +
+
+
+
+ {{template "repo/icon" .}} +
+ +
+ {{if .IsArchived}} + {{ctx.Locale.Tr "repo.desc.archived"}} +
{{svg "octicon-archive" 18}}
+ {{end}} + {{if .IsPrivate}} + {{ctx.Locale.Tr "repo.desc.private"}} +
{{svg "octicon-lock" 18}}
+ {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{ctx.Locale.Tr "repo.desc.internal"}} +
{{svg "octicon-shield-lock" 18}}
+ {{end}} + {{end}} + {{if .IsTemplate}} + {{ctx.Locale.Tr "repo.desc.template"}} +
{{svg "octicon-repo-template" 18}}
+ {{end}} + {{if eq .ObjectFormatName "sha256"}} + {{ctx.Locale.Tr "repo.desc.sha256"}} + {{end}} +
+
+ {{if not (or .IsBeingCreated .IsBroken)}} +
+ {{if $.RepoTransfer}} +
+ {{$.CsrfTokenHtml}} +
+ +
+
+
+ {{$.CsrfTokenHtml}} +
+ +
+
+ {{end}} + {{if $.EnableFeed}} + {{/* An extra div-element is not necessary here, as this button does not secretly contain two buttons. */}} + + {{svg "octicon-rss" 16}} + + {{end}} + {{template "repo/watch_unwatch" $}} + {{if not $.DisableStars}} + {{template "repo/star_unstar" $}} + {{end}} + {{if not $.DisableForks}} + {{template "repo/header_fork" $}} + {{end}} +
+ {{end}} +
+ {{if $.PullMirror}} +
+ {{ctx.Locale.Tr "repo.mirror_from"}} + {{$.PullMirror.RemoteAddress}} + {{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{DateUtils.TimeSince $.PullMirror.UpdatedUnix}}{{end}} +
+ {{end}} + {{if .IsFork}}
{{ctx.Locale.Tr "repo.forked_from"}} {{.BaseRepo.FullName}}
{{end}} + {{if .IsGenerated}}
{{ctx.Locale.Tr "repo.generated_from"}} {{(.TemplateRepo ctx).FullName}}
{{end}} +
+{{end}} + + {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} +
+ {{if .Permission.CanRead $.UnitTypeCode}} + + {{svg "octicon-code"}} Cope + + {{end}} + + {{if .Permission.CanRead $.UnitTypeIssues}} + + {{svg "octicon-issue-opened"}} Seethes + {{if .Repository.NumOpenIssues}} + {{CountFmt .Repository.NumOpenIssues}} + {{end}} + + {{end}} + + {{if .Permission.CanRead $.UnitTypeExternalTracker}} + + {{svg "octicon-link-external"}} Seethes + + {{end}} + + {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} + + {{svg "octicon-git-pull-request"}} Cope requests + {{if .Repository.NumOpenPulls}} + {{CountFmt .Repository.NumOpenPulls}} + {{end}} + + {{end}} + + {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} + + {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project"}} + {{if .Repository.NumOpenProjects}} + {{CountFmt .Repository.NumOpenProjects}} + {{end}} + + {{end}} + + {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}} + + {{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}} + {{if .NumReleases}} + {{CountFmt .NumReleases}} + {{end}} + + {{end}} + + {{if .Permission.CanRead $.UnitTypePackages}} + + {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} + {{if .NumPackages}} + {{CountFmt .NumPackages}} + {{end}} + + {{end}} + + {{if .Permission.CanRead $.UnitTypeWiki}} + + {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}} + + {{end}} + + {{if .Permission.CanRead $.UnitTypeExternalWiki}} + + {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}} + + {{end}} + + {{if and (.Permission.CanReadAny $.UnitTypeCode $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases)}} + + {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} + + {{end}} + + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} + + {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} + {{if .Repository.NumOpenActionRuns}} + {{CountFmt .Repository.NumOpenActionRuns}} + {{end}} + + {{end}} + + {{template "custom/extra_tabs" .}} + + {{if and RepoFlagsEnabled .SignedUser.IsAdmin}} + + {{svg "octicon-milestone"}} {{ctx.Locale.Tr "repo.admin.manage_flags"}} + + {{end}} + + {{if .Permission.IsAdmin}} + {{$highlightSettings := true}} + {{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}} + {{$highlightSettings = false}} + + {{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.settings.units.add_more"}} + + {{end}} + + {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} + + {{end}} +
+ {{else if .Permission.IsAdmin}} + + {{end}} +
+
+