Fix and improve repo visibility checkbox when FORCE_PRIVATE is on (#3786)
This was [implemented](022820103d
) 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 <earl-warren@noreply.codeberg.org>
This commit is contained in:
parent
cb551effb9
commit
fc0c5e80da
9 changed files with 98 additions and 63 deletions
|
@ -49,14 +49,17 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
|
|
|
@ -88,14 +88,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -62,14 +62,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -104,14 +104,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -100,14 +100,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}} checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -102,14 +102,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -99,14 +99,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -102,14 +102,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}} checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
|
@ -88,14 +88,18 @@
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
{{if .IsForcedPrivate}}
|
<input name="private" type="checkbox"
|
||||||
<input name="private" type="checkbox" checked readonly>
|
{{if .IsForcedPrivate}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
|
checked disabled
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
|
{{if .private}}checked{{end}}
|
||||||
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
{{end}}>
|
||||||
{{end}}
|
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{if .IsForcedPrivate}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span>
|
||||||
|
{{end}}
|
||||||
|
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_Description}}error{{end}}">
|
<div class="inline field {{if .Err_Description}}error{{end}}">
|
||||||
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
|
||||||
|
|
Loading…
Reference in a new issue