Skip to content

Commit

Permalink
Remove Fomantic-UI's .hidden CSS class for checkbox elements (#22851)
Browse files Browse the repository at this point in the history
Fomantic-UI's `.hidden` CSS class is badly designed.

* Checkbox elements do not need it in HTML, so this PR removes it (JS
adds the `.hidden` class back by `$('.ui.checkbox').checkbox()`)
* `menu transaction hidden` is still needed, and it should be the only
usage for the `.hidden` from now on (until they get refactored properly)

Co-authored-by: zeripath <[email protected]>
  • Loading branch information
wxiaoguang and zeripath authored Feb 13, 2023
1 parent c8093a1 commit eb5e1bc
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 50 deletions.
8 changes: 4 additions & 4 deletions templates/org/create.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
<span class="inline required field"><label for="visibility">{{.locale.Tr "org.settings.visibility"}}</label></span>
<div class="inline-grouped-list">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.public"}}</label>
</div>
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.limited"}}</label>
</div>
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.private"}}</label>
</div>
</div>
Expand All @@ -37,7 +37,7 @@
<label>{{.locale.Tr "org.settings.permission"}}</label>
<div class="inline-grouped-list">
<div class="ui checkbox">
<input class="hidden" type="checkbox" name="repo_admin_change_team_access" checked/>
<input type="checkbox" name="repo_admin_change_team_access" checked/>
<label>{{.locale.Tr "org.settings.repoadminchangeteam"}}</label>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/org/settings/options.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
<label for="visibility">{{.locale.Tr "org.settings.visibility"}}</label>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.public"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.limited"}}</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input class="hidden enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.visibility.private"}}</label>
</div>
</div>
Expand All @@ -63,7 +63,7 @@
<label>{{.locale.Tr "org.settings.permission"}}</label>
<div class="field">
<div class="ui checkbox">
<input class="hidden" type="checkbox" name="repo_admin_change_team_access" {{if .RepoAdminChangeTeamAccess}}checked{{end}}/>
<input type="checkbox" name="repo_admin_change_team_access" {{if .RepoAdminChangeTeamAccess}}checked{{end}}/>
<label>{{.locale.Tr "org.settings.repoadminchangeteam"}}</label>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/org/team/new.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@
</td>
<td class="center aligned">
<div class="ui radio checkbox">
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="0"{{if or ($unit.Type.UnitGlobalDisabled) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 0)}} checked{{end}} title="{{$.locale.Tr "org.teams.none_access"}}">
<input type="radio" name="unit_{{$unit.Type.Value}}" value="0"{{if or ($unit.Type.UnitGlobalDisabled) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 0)}} checked{{end}} title="{{$.locale.Tr "org.teams.none_access"}}">
</div>
</td>
<td class="center aligned">
<div class="ui radio checkbox">
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{$.locale.Tr "org.teams.read_access"}}">
<input type="radio" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{$.locale.Tr "org.teams.read_access"}}">
</div>
</td>
<td class="center aligned">
<div class="ui radio checkbox">
<input type="radio" class="hidden" name="unit_{{$unit.Type.Value}}" value="2"{{if (eq ($.Team.UnitAccessMode $.Context $unit.Type) 2)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{$.locale.Tr "org.teams.write_access"}}">
<input type="radio" name="unit_{{$unit.Type.Value}}" value="2"{{if (eq ($.Team.UnitAccessMode $.Context $unit.Type) 2)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{$.locale.Tr "org.teams.write_access"}}">
</div>
</td>
</tr>
Expand All @@ -121,7 +121,7 @@
{{if lt $unit.MaxPerm 2}}
<div {{if $unit.Type.UnitGlobalDisabled}}class="field tooltip" data-content="{{$.locale.Tr "repo.unit_disabled"}}"{{else}}class="field"{{end}}>
<div class="ui checkbox">
<input type="checkbox" class="hidden" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
<input type="checkbox" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}>
<label>{{$.locale.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.locale.Tr "org.team_unit_disabled"}}{{end}}</label>
<span class="help">{{$.locale.Tr $unit.DescKey}}</span>
</div>
Expand Down
16 changes: 8 additions & 8 deletions templates/repo/create.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,33 @@
<div class="inline field">
<label>{{.locale.Tr "repo.template.items"}}</label>
<div class="ui checkbox">
<input class="hidden" name="git_content" type="checkbox" tabindex="0" {{if .git_content}}checked{{end}}>
<input name="git_content" type="checkbox" tabindex="0" {{if .git_content}}checked{{end}}>
<label>{{.locale.Tr "repo.template.git_content"}}</label>
</div>
<div class="ui checkbox{{if not .SignedUser.CanEditGitHook}} tooltip{{end}}"{{if not .SignedUser.CanEditGitHook}} data-content="{{.locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}>
<input class="hidden" name="git_hooks" type="checkbox" tabindex="0" {{if .git_hooks}}checked{{end}}>
<input name="git_hooks" type="checkbox" tabindex="0" {{if .git_hooks}}checked{{end}}>
<label>{{.locale.Tr "repo.template.git_hooks"}}</label>
</div>
</div>
<div class="inline field">
<label></label>
<div class="ui checkbox">
<input class="hidden" name="webhooks" type="checkbox" tabindex="0" {{if .webhooks}}checked{{end}}>
<input name="webhooks" type="checkbox" tabindex="0" {{if .webhooks}}checked{{end}}>
<label>{{.locale.Tr "repo.template.webhooks"}}</label>
</div>
<div class="ui checkbox">
<input class="hidden" name="topics" type="checkbox" tabindex="0" {{if .topics}}checked{{end}}>
<input name="topics" type="checkbox" tabindex="0" {{if .topics}}checked{{end}}>
<label>{{.locale.Tr "repo.template.topics"}}</label>
</div>
</div>
<div class="inline field">
<label></label>
<div class="ui checkbox">
<input class="hidden" name="avatar" type="checkbox" tabindex="0" {{if .avatar}}checked{{end}}>
<input name="avatar" type="checkbox" tabindex="0" {{if .avatar}}checked{{end}}>
<label>{{.locale.Tr "repo.template.avatar"}}</label>
</div>
<div class="ui checkbox">
<input class="hidden" name="labels" type="checkbox" tabindex="0" {{if .labels}}checked{{end}}>
<input name="labels" type="checkbox" tabindex="0" {{if .labels}}checked{{end}}>
<label>{{.locale.Tr "repo.template.issue_labels"}}</label>
</div>
</div>
Expand Down Expand Up @@ -169,7 +169,7 @@
</div>
<div class="inline field">
<div class="ui checkbox" id="auto-init">
<input class="hidden" name="auto_init" type="checkbox" tabindex="0" {{if .auto_init}}checked{{end}}>
<input name="auto_init" type="checkbox" tabindex="0" {{if .auto_init}}checked{{end}}>
<label>{{.locale.Tr "repo.auto_init"}}</label>
</div>
</div>
Expand Down Expand Up @@ -204,7 +204,7 @@
<div class="inline field">
<label>{{.locale.Tr "repo.template"}}</label>
<div class="ui checkbox">
<input class="hidden" name="template" type="checkbox" tabindex="0">
<input name="template" type="checkbox" tabindex="0">
<label>{{.locale.Tr "repo.template_helper"}}</label>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/editor/commit_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="inline field">
<div class="ui checkbox">
<input name="signoff" type="checkbox" tabindex="0" class="hidden">
<input name="signoff" type="checkbox" tabindex="0">
<label>{{.locale.Tr "repo.editor.signoff_desc"}}</label>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/settings/deploy_keys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
<div class="field">
<div class="ui checkbox {{if .Err_IsWritable}}error{{end}}">
<input id="ssh-key-is-writable" name="is_writable" class="hidden" type="checkbox" value="1">
<input id="ssh-key-is-writable" name="is_writable" type="checkbox" value="1">
<label for="is_writable">
{{.locale.Tr "repo.settings.is_writable"}}
</label>
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/settings/options.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
{{else}}
<div class="ui radio checkbox">
{{end}}
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}/>
<label>{{.locale.Tr "repo.settings.use_internal_wiki"}}</label>
</div>
</div>
Expand All @@ -291,7 +291,7 @@
{{else}}
<div class="ui radio checkbox">
{{end}}
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}/>
<label>{{.locale.Tr "repo.settings.use_external_wiki"}}</label>
</div>
</div>
Expand Down Expand Up @@ -323,7 +323,7 @@
{{else}}
<div class="ui radio checkbox">
{{end}}
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}/>
<label>{{.locale.Tr "repo.settings.use_internal_issue_tracker"}}</label>
</div>
</div>
Expand Down Expand Up @@ -359,7 +359,7 @@
{{else}}
<div class="ui radio checkbox">
{{end}}
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}/>
<input class="enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}/>
<label>{{.locale.Tr "repo.settings.use_external_issue_tracker"}}</label>
</div>
</div>
Expand Down
Loading

0 comments on commit eb5e1bc

Please sign in to comment.