loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <earl-warren@noreply.codeberg.org>

0ko fc0c5e80 cb551eff

+98 -63
+10 -7
templates/repo/create.tmpl
··· 49 49 <div class="inline field"> 50 50 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 51 51 <div class="ui checkbox"> 52 - {{if .IsForcedPrivate}} 53 - <input name="private" type="checkbox" checked readonly> 54 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 55 - {{else}} 56 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 57 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 58 - {{end}} 52 + <input name="private" type="checkbox" 53 + {{if .IsForcedPrivate}} 54 + checked disabled 55 + {{else}} 56 + {{if .private}}checked{{end}} 57 + {{end}}> 58 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 59 59 </div> 60 + {{if .IsForcedPrivate}} 61 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 62 + {{end}} 60 63 <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 61 64 </div> 62 65 <div class="inline field {{if .Err_Description}}error{{end}}">
+11 -7
templates/repo/migrate/codebase.tmpl
··· 88 88 <div class="inline field"> 89 89 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 90 90 <div class="ui checkbox"> 91 - {{if .IsForcedPrivate}} 92 - <input name="private" type="checkbox" checked readonly> 93 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 94 - {{else}} 95 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 96 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 97 - {{end}} 91 + <input name="private" type="checkbox" 92 + {{if .IsForcedPrivate}} 93 + checked disabled 94 + {{else}} 95 + {{if .private}}checked{{end}} 96 + {{end}}> 97 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 98 98 </div> 99 + {{if .IsForcedPrivate}} 100 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 101 + {{end}} 102 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 99 103 </div> 100 104 <div class="inline field {{if .Err_Description}}error{{end}}"> 101 105 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/git.tmpl
··· 62 62 <div class="inline field"> 63 63 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 64 64 <div class="ui checkbox"> 65 - {{if .IsForcedPrivate}} 66 - <input name="private" type="checkbox" checked readonly> 67 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 68 - {{else}} 69 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 70 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 71 - {{end}} 65 + <input name="private" type="checkbox" 66 + {{if .IsForcedPrivate}} 67 + checked disabled 68 + {{else}} 69 + {{if .private}}checked{{end}} 70 + {{end}}> 71 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 72 72 </div> 73 + {{if .IsForcedPrivate}} 74 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 75 + {{end}} 76 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 73 77 </div> 74 78 <div class="inline field {{if .Err_Description}}error{{end}}"> 75 79 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/gitbucket.tmpl
··· 104 104 <div class="inline field"> 105 105 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 106 106 <div class="ui checkbox"> 107 - {{if .IsForcedPrivate}} 108 - <input name="private" type="checkbox" checked readonly> 109 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 110 - {{else}} 111 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 112 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 113 - {{end}} 107 + <input name="private" type="checkbox" 108 + {{if .IsForcedPrivate}} 109 + checked disabled 110 + {{else}} 111 + {{if .private}}checked{{end}} 112 + {{end}}> 113 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 114 114 </div> 115 + {{if .IsForcedPrivate}} 116 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 117 + {{end}} 118 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 115 119 </div> 116 120 <div class="inline field {{if .Err_Description}}error{{end}}"> 117 121 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/gitea.tmpl
··· 100 100 <div class="inline field"> 101 101 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 102 102 <div class="ui checkbox"> 103 - {{if .IsForcedPrivate}} 104 - <input name="private" type="checkbox" checked readonly> 105 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 106 - {{else}} 107 - <input name="private" type="checkbox" {{if .private}} checked{{end}}> 108 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 109 - {{end}} 103 + <input name="private" type="checkbox" 104 + {{if .IsForcedPrivate}} 105 + checked disabled 106 + {{else}} 107 + {{if .private}}checked{{end}} 108 + {{end}}> 109 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 110 110 </div> 111 + {{if .IsForcedPrivate}} 112 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 113 + {{end}} 114 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 111 115 </div> 112 116 <div class="inline field {{if .Err_Description}}error{{end}}"> 113 117 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/github.tmpl
··· 102 102 <div class="inline field"> 103 103 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 104 104 <div class="ui checkbox"> 105 - {{if .IsForcedPrivate}} 106 - <input name="private" type="checkbox" checked readonly> 107 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 108 - {{else}} 109 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 110 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 111 - {{end}} 105 + <input name="private" type="checkbox" 106 + {{if .IsForcedPrivate}} 107 + checked disabled 108 + {{else}} 109 + {{if .private}}checked{{end}} 110 + {{end}}> 111 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 112 112 </div> 113 + {{if .IsForcedPrivate}} 114 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 115 + {{end}} 116 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 113 117 </div> 114 118 <div class="inline field {{if .Err_Description}}error{{end}}"> 115 119 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/gitlab.tmpl
··· 99 99 <div class="inline field"> 100 100 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 101 101 <div class="ui checkbox"> 102 - {{if .IsForcedPrivate}} 103 - <input name="private" type="checkbox" checked readonly> 104 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 105 - {{else}} 106 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 107 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 108 - {{end}} 102 + <input name="private" type="checkbox" 103 + {{if .IsForcedPrivate}} 104 + checked disabled 105 + {{else}} 106 + {{if .private}}checked{{end}} 107 + {{end}}> 108 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 109 109 </div> 110 + {{if .IsForcedPrivate}} 111 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 112 + {{end}} 113 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 110 114 </div> 111 115 <div class="inline field {{if .Err_Description}}error{{end}}"> 112 116 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/gogs.tmpl
··· 102 102 <div class="inline field"> 103 103 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 104 104 <div class="ui checkbox"> 105 - {{if .IsForcedPrivate}} 106 - <input name="private" type="checkbox" checked readonly> 107 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 108 - {{else}} 109 - <input name="private" type="checkbox" {{if .private}} checked{{end}}> 110 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 111 - {{end}} 105 + <input name="private" type="checkbox" 106 + {{if .IsForcedPrivate}} 107 + checked disabled 108 + {{else}} 109 + {{if .private}}checked{{end}} 110 + {{end}}> 111 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 112 112 </div> 113 + {{if .IsForcedPrivate}} 114 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 115 + {{end}} 116 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 113 117 </div> 114 118 <div class="inline field {{if .Err_Description}}error{{end}}"> 115 119 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
+11 -7
templates/repo/migrate/onedev.tmpl
··· 88 88 <div class="inline field"> 89 89 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 90 90 <div class="ui checkbox"> 91 - {{if .IsForcedPrivate}} 92 - <input name="private" type="checkbox" checked readonly> 93 - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> 94 - {{else}} 95 - <input name="private" type="checkbox" {{if .private}}checked{{end}}> 96 - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 97 - {{end}} 91 + <input name="private" type="checkbox" 92 + {{if .IsForcedPrivate}} 93 + checked disabled 94 + {{else}} 95 + {{if .private}}checked{{end}} 96 + {{end}}> 97 + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> 98 98 </div> 99 + {{if .IsForcedPrivate}} 100 + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> 101 + {{end}} 102 + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> 99 103 </div> 100 104 <div class="inline field {{if .Err_Description}}error{{end}}"> 101 105 <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>