From 9dcdf8d828508146f4c9ada70ac692f3dcd212d6 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Sat, 16 Mar 2024 12:46:43 +0100 Subject: [PATCH] Locales, field & action --- models/repo/repo.go | 2 ++ options/locale/locale_de-DE.ini | 1 + options/locale/locale_en-US.ini | 1 + templates/repo/settings/options.tmpl | 34 ++++++++++++++++++++-------- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/models/repo/repo.go b/models/repo/repo.go index a7bc4b3c72..3b20b2d9bd 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -136,6 +136,8 @@ type Repository struct { OriginalURL string `xorm:"VARCHAR(2048)"` DefaultBranch string WikiBranch string + // TODO: Create own table out of this field + FederationRepos string NumWatches int NumStars int diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index 17ed1b2a5b..5cd0287571 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -1991,6 +1991,7 @@ settings.collaboration.undefined=Nicht definiert settings.hooks=Webhooks settings.githooks=Git-Hooks settings.basic_settings=Grundeinstellungen +settings.federation_settings=Federation-Einstellungen settings.mirror_settings=Mirror-Einstellungen settings.mirror_settings.docs=Richte Dein Repository so ein, dass es automatisch Commits, Tags und Branches mit einem anderen Repository synchronisieren kann. settings.mirror_settings.docs.disabled_pull_mirror.instructions=Richte Dein Projekt so ein, dass es automatisch Commits, Tags und Branches in ein anderes Repository pusht. Pull-Mirrors wurden von Deinem Website-Administrator deaktiviert. diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 95ce92e882..69ce7583dd 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2042,6 +2042,7 @@ settings.collaboration.undefined = Undefined settings.hooks = Webhooks settings.githooks = Git Hooks settings.basic_settings = Basic Settings +settings.federation_settings=Federation Settings settings.mirror_settings = Mirror Settings settings.mirror_settings.docs = Set up your repository to automatically synchronize commits, tags and branches with another repository. settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push commits, tags and branches to another repository. Pull mirrors have been disabled by your site administrator. diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 5ce3cf3448..321ea6ecda 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -63,11 +63,35 @@ + /* TODO: get true/false from settings */ + {{$showFederationSettings := true}} + {{if $showFederationSettings}} +

+ {{ctx.Locale.Tr "repo.settings.federation_settings"}} +

+
+
+ {{.CsrfTokenHtml}} + + + /* TODO: implement Err_FederationRepos somewhere */ +
+ /* TODO: internationalize text */ + + +
+
+ +
+
+
+ {{end}} + + {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}} {{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}} - {{$showFederationSettings := true}} {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} @@ -75,14 +99,6 @@ {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} {{$isWorkingPullMirror := .PullMirror}} - {{if $showFederationSettings}} -

- Federation -

-
- Repositories federated with the current one. -
- {{end}} {{if $showMirrorSettings}}