From fc0c5e80da78c67706de6a81f749f7e85bdc6560 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Thu, 16 May 2024 05:51:55 +0000 Subject: [PATCH] Fix and improve repo visibility checkbox when FORCE_PRIVATE is on (#3786) This was [implemented](https://github.com/gogs/gogs/commit/022820103d622dda74aa1c619ca46838a14b762a) almost 10 years ago in Gogs. It was using `readonly` attribute instead of `disabled` on checkbox which was doing nothing. According to [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly), `readonly` attribute is not applicable to checkbox inputs. This bug was reported by mrwusel in Matrix room. Fork page that has similar UI feature did not have this bug. - replace `readonly` with `disabled` - do not put info about the restriction directly into the checkbox title ### Before ![image](/attachments/6adaf1a3-6e28-416a-ac85-aa6e570e438d) ### After ![image](/attachments/3590b02b-3c83-4864-bae8-ff1a6a56b2b0) ### In other case ![image](/attachments/7f49d84d-5b3a-43a1-b09c-fb6089c1fb5e) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3786 Reviewed-by: Earl Warren --- templates/repo/create.tmpl | 17 ++++++++++------- templates/repo/migrate/codebase.tmpl | 18 +++++++++++------- templates/repo/migrate/git.tmpl | 18 +++++++++++------- templates/repo/migrate/gitbucket.tmpl | 18 +++++++++++------- templates/repo/migrate/gitea.tmpl | 18 +++++++++++------- templates/repo/migrate/github.tmpl | 18 +++++++++++------- templates/repo/migrate/gitlab.tmpl | 18 +++++++++++------- templates/repo/migrate/gogs.tmpl | 18 +++++++++++------- templates/repo/migrate/onedev.tmpl | 18 +++++++++++------- 9 files changed, 98 insertions(+), 63 deletions(-) diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index bcc04ff28d..3afd978ee9 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -49,14 +49,17 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/codebase.tmpl b/templates/repo/migrate/codebase.tmpl index 439a883863..1b5e84067e 100644 --- a/templates/repo/migrate/codebase.tmpl +++ b/templates/repo/migrate/codebase.tmpl @@ -88,14 +88,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index db01b8d858..5ebf4cfd6a 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -62,14 +62,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/gitbucket.tmpl b/templates/repo/migrate/gitbucket.tmpl index d1f1db99ba..6d671777a4 100644 --- a/templates/repo/migrate/gitbucket.tmpl +++ b/templates/repo/migrate/gitbucket.tmpl @@ -104,14 +104,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/gitea.tmpl b/templates/repo/migrate/gitea.tmpl index f2a3ae4348..20d85c27c7 100644 --- a/templates/repo/migrate/gitea.tmpl +++ b/templates/repo/migrate/gitea.tmpl @@ -100,14 +100,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl index dfb2b4bc46..6e801b8c1d 100644 --- a/templates/repo/migrate/github.tmpl +++ b/templates/repo/migrate/github.tmpl @@ -102,14 +102,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl index 76c2828257..164578222e 100644 --- a/templates/repo/migrate/gitlab.tmpl +++ b/templates/repo/migrate/gitlab.tmpl @@ -99,14 +99,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/gogs.tmpl b/templates/repo/migrate/gogs.tmpl index b01d0eeb67..312a4e9e9a 100644 --- a/templates/repo/migrate/gogs.tmpl +++ b/templates/repo/migrate/gogs.tmpl @@ -102,14 +102,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}
diff --git a/templates/repo/migrate/onedev.tmpl b/templates/repo/migrate/onedev.tmpl index 8b2a2d8730..a5a216c6ec 100644 --- a/templates/repo/migrate/onedev.tmpl +++ b/templates/repo/migrate/onedev.tmpl @@ -88,14 +88,18 @@
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} + +
+ {{if .IsForcedPrivate}} + {{ctx.Locale.Tr "repo.visibility_helper_forced"}} + {{end}} + {{ctx.Locale.Tr "repo.visibility_description"}}