1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

Locales, field & action

This commit is contained in:
Michael Jerger 2024-03-16 12:46:43 +01:00
parent fdcff3cc43
commit 9dcdf8d828
4 changed files with 29 additions and 9 deletions

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -63,11 +63,35 @@
</form>
</div>
/* TODO: get true/false from settings */
{{$showFederationSettings := true}}
{{if $showFederationSettings}}
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.federation_settings"}}
</h4>
<div class="ui attached segment">
<form class="ui form" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="federation">
/* TODO: implement Err_FederationRepos somewhere */
<div class="field {{if .Err_FederationRepos}}error{{end}}">
/* TODO: internationalize text */
<label for="federation_repos">Federation Repositories</label>
<input id="federation_repos" name="federation_repos" value="{{.Repository.FederationRepos}}" data-repo-name="{{.Repository.FederationRepos}}">
</div>
<div class="field">
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
</div>
</form>
</div>
{{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}}
<h4 class="ui top attached header">
Federation
</h4>
<div class="ui attached segment">
Repositories federated with the current one.
</div>
{{end}}
{{if $showMirrorSettings}}
<h4 class="ui top attached header">