Skip to content

Commit ec3d467

Browse files
Migrate gt-hidden to tw-hidden (#30046)
We have to define this one in helpers.css because tailwind only generates a single class but certain things rely on this being double-class. Command ran: ```sh perl -p -i -e 's#gt-hidden#tw-hidden#g' web_src/js/**/* templates/**/* models/**/* web_src/css/**/* --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 0a2f973 commit ec3d467

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+195
-192
lines changed

docs/content/contributing/guidelines-frontend.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ However, there are still some special cases, so the current guideline is:
118118
### Show/Hide Elements
119119

120120
* Vue components are recommended to use `v-if` and `v-show` to show/hide elements.
121-
* Go template code should use Gitea's `.gt-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.gt-hidden`'s comment.
121+
* Go template code should use `.tw-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.tw-hidden`'s comment.
122122

123123
### Styles and Attributes in Go HTML Template
124124

docs/content/contributing/guidelines-frontend.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
117117
### 显示/隐藏元素
118118

119119
* 推荐在Vue组件中使用`v-if``v-show`来显示/隐藏元素。
120-
* Go 模板代码应使用 Gitea 的 `.gt-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-hidden`的注释以获取更多详细信息。
120+
* Go 模板代码应使用 `.tw-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
121121

122122
### Go HTML 模板中的样式和属性
123123

tailwind.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export default {
4141
// classes that don't work without CSS variables from "@tailwind base" which we don't use
4242
'transform', 'shadow', 'ring', 'blur', 'grayscale', 'invert', '!invert', 'filter', '!filter',
4343
'backdrop-filter',
44+
// we use double-class tw-hidden defined in web_src/css/helpers.css for increased specificity
45+
'hidden',
4446
// unneeded classes
4547
'[-a-zA-Z:0-9_.]',
4648
],

templates/admin/auth/edit.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label>
4343
<input id="port" name="port" value="{{$cfg.Port}}" placeholder="636" required>
4444
</div>
45-
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
45+
<div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}">
4646
<div class="ui checkbox">
4747
<label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
4848
<input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>
@@ -113,7 +113,7 @@
113113
<input type="checkbox" name="groups_enabled" class="js-ldap-group-toggle" {{if $cfg.GroupsEnabled}}checked{{end}}>
114114
</div>
115115
</div>
116-
<div id="ldap-group-options" class="ui segment secondary {{if not $cfg.GroupsEnabled}}gt-hidden{{end}}">
116+
<div id="ldap-group-options" class="ui segment secondary {{if not $cfg.GroupsEnabled}}tw-hidden{{end}}">
117117
<div class="field">
118118
<label>{{ctx.Locale.Tr "admin.auths.group_search_base"}}</label>
119119
<input name="group_dn" value="{{$cfg.GroupDN}}" placeholder="ou=group,dc=mydomain,dc=com">
@@ -148,7 +148,7 @@
148148
<input id="use_paged_search" name="use_paged_search" type="checkbox" {{if $cfg.UsePagedSearch}}checked{{end}}>
149149
</div>
150150
</div>
151-
<div class="field required search-page-size{{if not $cfg.UsePagedSearch}} gt-hidden{{end}}">
151+
<div class="field required search-page-size{{if not $cfg.UsePagedSearch}} tw-hidden{{end}}">
152152
<label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label>
153153
<input id="search_page_size" name="search_page_size" value="{{if $cfg.UsePagedSearch}}{{$cfg.SearchPageSize}}{{end}}">
154154
</div>
@@ -205,7 +205,7 @@
205205
</div>
206206
<p class="help">{{ctx.Locale.Tr "admin.auths.force_smtps_helper"}}</p>
207207
</div>
208-
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
208+
<div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}">
209209
<div class="ui checkbox">
210210
<label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
211211
<input name="skip_verify" type="checkbox" {{if $cfg.SkipVerify}}checked{{end}}>

templates/admin/auth/new.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
{{template "admin/auth/source/smtp" .}}
3434

3535
<!-- PAM -->
36-
<div class="pam required field {{if not (eq .type 4)}}gt-hidden{{end}}">
36+
<div class="pam required field {{if not (eq .type 4)}}tw-hidden{{end}}">
3737
<label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label>
3838
<input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}">
3939
<label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label>
4040
<input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}">
4141
</div>
42-
<div class="pam optional field {{if not (eq .type 4)}}gt-hidden{{end}}">
42+
<div class="pam optional field {{if not (eq .type 4)}}tw-hidden{{end}}">
4343
<div class="ui checkbox">
4444
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
4545
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
@@ -59,7 +59,7 @@
5959
<input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
6060
</div>
6161
</div>
62-
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
62+
<div class="ldap inline field {{if not (eq .type 2)}}tw-hidden{{end}}">
6363
<div class="ui checkbox">
6464
<label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label>
6565
<input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>

templates/admin/auth/source/ldap.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}gt-hidden{{end}}">
1+
<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}tw-hidden{{end}}">
22
<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
33
<label>{{ctx.Locale.Tr "admin.auths.security_protocol"}}</label>
44
<div class="ui selection security-protocol dropdown">
@@ -20,25 +20,25 @@
2020
<label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label>
2121
<input id="port" name="port" value="{{.port}}" placeholder="636">
2222
</div>
23-
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
23+
<div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}">
2424
<div class="ui checkbox">
2525
<label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
2626
<input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
2727
</div>
2828
</div>
29-
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
29+
<div class="ldap field {{if not (eq .type 2)}}tw-hidden{{end}}">
3030
<label for="bind_dn">{{ctx.Locale.Tr "admin.auths.bind_dn"}}</label>
3131
<input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="cn=Search,dc=mydomain,dc=com">
3232
</div>
33-
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
33+
<div class="ldap field {{if not (eq .type 2)}}tw-hidden{{end}}">
3434
<label for="bind_password">{{ctx.Locale.Tr "admin.auths.bind_password"}}</label>
3535
<input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}">
3636
</div>
3737
<div class="binddnrequired {{if (eq .type 2)}}required{{end}} field">
3838
<label for="user_base">{{ctx.Locale.Tr "admin.auths.user_base"}}</label>
3939
<input id="user_base" name="user_base" value="{{.user_base}}" placeholder="ou=Users,dc=mydomain,dc=com">
4040
</div>
41-
<div class="dldap required field {{if not (eq .type 5)}}gt-hidden{{end}}">
41+
<div class="dldap required field {{if not (eq .type 5)}}tw-hidden{{end}}">
4242
<label for="user_dn">{{ctx.Locale.Tr "admin.auths.user_dn"}}</label>
4343
<input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="uid=%s,ou=Users,dc=mydomain,dc=com">
4444
</div>
@@ -115,13 +115,13 @@
115115
</div>
116116
<!-- ldap group end -->
117117

118-
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
118+
<div class="ldap inline field {{if not (eq .type 2)}}tw-hidden{{end}}">
119119
<div class="ui checkbox">
120120
<label for="use_paged_search"><strong>{{ctx.Locale.Tr "admin.auths.use_paged_search"}}</strong></label>
121121
<input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}>
122122
</div>
123123
</div>
124-
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}gt-hidden{{end}}">
124+
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}tw-hidden{{end}}">
125125
<label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label>
126126
<input id="search_page_size" name="search_page_size" value="{{.search_page_size}}">
127127
</div>

templates/admin/auth/source/oauth.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="oauth2 field {{if not (eq .type 6)}}gt-hidden{{end}}">
1+
<div class="oauth2 field {{if not (eq .type 6)}}tw-hidden{{end}}">
22
<div class="inline required field">
33
<label>{{ctx.Locale.Tr "admin.auths.oauth2_provider"}}</label>
44
<div class="ui selection type dropdown">

templates/admin/auth/source/smtp.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="smtp field {{if not (eq .type 3)}}gt-hidden{{end}}">
1+
<div class="smtp field {{if not (eq .type 3)}}tw-hidden{{end}}">
22
<div class="inline required field">
33
<label>{{ctx.Locale.Tr "admin.auths.smtp_auth"}}</label>
44
<div class="ui selection type dropdown">

templates/admin/auth/source/sspi.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sspi field {{if not (eq .type 7)}}gt-hidden{{end}}">
1+
<div class="sspi field {{if not (eq .type 7)}}tw-hidden{{end}}">
22
<div class="field">
33
<div class="ui checkbox">
44
<label for="sspi_auto_create_users"><strong>{{ctx.Locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label>

templates/admin/user/edit.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</div>
5454
</div>
5555

56-
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}gt-hidden{{end}}">
56+
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}tw-hidden{{end}}">
5757
<label for="login_name">{{ctx.Locale.Tr "admin.users.auth_login_name"}}</label>
5858
<input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus>
5959
</div>
@@ -65,7 +65,7 @@
6565
<label for="email">{{ctx.Locale.Tr "email"}}</label>
6666
<input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required>
6767
</div>
68-
<div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}gt-hidden{{end}}">
68+
<div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}tw-hidden{{end}}">
6969
<label for="password">{{ctx.Locale.Tr "password"}}</label>
7070
<input id="password" name="password" type="password" autocomplete="new-password">
7171
<p class="help">{{ctx.Locale.Tr "admin.users.password_helper"}}</p>
@@ -128,13 +128,13 @@
128128
<input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}>
129129
</div>
130130
</div>
131-
<div class="inline field {{if DisableGitHooks}}gt-hidden{{end}}">
131+
<div class="inline field {{if DisableGitHooks}}tw-hidden{{end}}">
132132
<div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.users.allow_git_hook_tooltip"}}">
133133
<label><strong>{{ctx.Locale.Tr "admin.users.allow_git_hook"}}</strong></label>
134134
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}>
135135
</div>
136136
</div>
137-
<div class="inline field {{if or (DisableImportLocal) (.DisableMigrations)}}gt-hidden{{end}}">
137+
<div class="inline field {{if or (DisableImportLocal) (.DisableMigrations)}}tw-hidden{{end}}">
138138
<div class="ui checkbox">
139139
<label><strong>{{ctx.Locale.Tr "admin.users.allow_import_local"}}</strong></label>
140140
<input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if DisableImportLocal}}disabled{{end}}>

0 commit comments

Comments
 (0)