Browse Source

Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, remove inline style=display:none (#22950)

Close #22847

This PR:

* introduce Gitea's own `showElem` and related functions
* remove jQuery show/hide
* remove .hide class
* remove inline style=display:none 

From now on:

do not use:
* "[hidden]" attribute: it's too weak, can not be applied to an element
with "display: flex"
* ".hidden" class: it has been polluted by Fomantic UI in many cases
* inline style="display: none": it's difficult to tweak
* jQuery's show/hide/toggle: it can not show/hide elements with
"display: xxx !important"

only use:
* this ".gt-hidden" class
* showElem/hideElem/toggleElem functions in "utils/dom.js"

cc: @silverwind , this is the all-in-one PR
tags/v1.19.0-rc0
wxiaoguang 1 year ago
parent
commit
d32af84a10
No account linked to committer's email address
89 changed files with 369 additions and 281 deletions
  1. 3
    3
      .eslintrc.yaml
  2. 5
    0
      docs/content/doc/developers/guidelines-frontend.en-us.md
  3. 3
    3
      templates/admin/auth/edit.tmpl
  4. 3
    3
      templates/admin/auth/new.tmpl
  5. 7
    7
      templates/admin/auth/source/ldap.tmpl
  6. 1
    1
      templates/admin/auth/source/oauth.tmpl
  7. 1
    1
      templates/admin/auth/source/smtp.tmpl
  8. 1
    1
      templates/admin/auth/source/sspi.tmpl
  9. 3
    3
      templates/admin/user/edit.tmpl
  10. 5
    5
      templates/install.tmpl
  11. 2
    2
      templates/org/settings/options.tmpl
  12. 1
    1
      templates/org/team/new.tmpl
  13. 1
    1
      templates/repo/blame.tmpl
  14. 1
    1
      templates/repo/branch_dropdown.tmpl
  15. 1
    1
      templates/repo/commits_list.tmpl
  16. 1
    1
      templates/repo/commits_list_small.tmpl
  17. 1
    1
      templates/repo/create.tmpl
  18. 4
    4
      templates/repo/diff/box.tmpl
  19. 1
    1
      templates/repo/diff/comment_form.tmpl
  20. 2
    2
      templates/repo/diff/comments.tmpl
  21. 6
    6
      templates/repo/diff/compare.tmpl
  22. 2
    2
      templates/repo/diff/conversation.tmpl
  23. 1
    1
      templates/repo/diff/image_diff.tmpl
  24. 1
    1
      templates/repo/editor/edit.tmpl
  25. 1
    1
      templates/repo/editor/patch.tmpl
  26. 1
    1
      templates/repo/find/files.tmpl
  27. 1
    1
      templates/repo/graph.tmpl
  28. 2
    2
      templates/repo/home.tmpl
  29. 1
    1
      templates/repo/issue/branch_selector_field.tmpl
  30. 1
    1
      templates/repo/issue/labels/label.tmpl
  31. 1
    1
      templates/repo/issue/labels/labels_sidebar.tmpl
  32. 1
    1
      templates/repo/issue/list.tmpl
  33. 1
    1
      templates/repo/issue/milestone_issues.tmpl
  34. 4
    4
      templates/repo/issue/new_form.tmpl
  35. 4
    4
      templates/repo/issue/view_content.tmpl
  36. 6
    6
      templates/repo/issue/view_content/comments.tmpl
  37. 1
    1
      templates/repo/issue/view_content/pull.tmpl
  38. 1
    1
      templates/repo/issue/view_content/pull_merge_instruction.tmpl
  39. 6
    6
      templates/repo/issue/view_content/sidebar.tmpl
  40. 4
    4
      templates/repo/issue/view_title.tmpl
  41. 2
    2
      templates/repo/migrate/migrating.tmpl
  42. 2
    2
      templates/repo/migrate/options.tmpl
  43. 1
    1
      templates/repo/settings/deploy_keys.tmpl
  44. 1
    1
      templates/repo/settings/githook_edit.tmpl
  45. 1
    1
      templates/repo/settings/lfs_file.tmpl
  46. 1
    1
      templates/repo/settings/webhook/history.tmpl
  47. 1
    1
      templates/repo/settings/webhook/settings.tmpl
  48. 1
    1
      templates/repo/sub_menu.tmpl
  49. 2
    2
      templates/repo/view_file.tmpl
  50. 1
    1
      templates/repo/view_list.tmpl
  51. 1
    1
      templates/repo/wiki/view.tmpl
  52. 1
    1
      templates/shared/secrets/add_list.tmpl
  53. 9
    9
      templates/user/auth/webauthn_error.tmpl
  54. 1
    1
      templates/user/notification/notification_div.tmpl
  55. 1
    1
      templates/user/settings/keys_gpg.tmpl
  56. 1
    1
      templates/user/settings/keys_principal.tmpl
  57. 1
    1
      templates/user/settings/keys_ssh.tmpl
  58. 2
    2
      templates/user/settings/profile.tmpl
  59. 3
    3
      web_src/js/components/DiffFileTree.vue
  60. 23
    22
      web_src/js/features/admin/common.js
  61. 5
    4
      web_src/js/features/common-global.js
  62. 3
    2
      web_src/js/features/common-issue.js
  63. 5
    4
      web_src/js/features/common-organization.js
  64. 4
    3
      web_src/js/features/comp/WebHookEditor.js
  65. 4
    3
      web_src/js/features/imagediff.js
  66. 4
    3
      web_src/js/features/install.js
  67. 3
    2
      web_src/js/features/org-team.js
  68. 2
    1
      web_src/js/features/repo-commit.js
  69. 4
    3
      web_src/js/features/repo-common.js
  70. 4
    4
      web_src/js/features/repo-diff.js
  71. 3
    2
      web_src/js/features/repo-editor.js
  72. 2
    1
      web_src/js/features/repo-findfile.js
  73. 6
    6
      web_src/js/features/repo-graph.js
  74. 6
    5
      web_src/js/features/repo-home.js
  75. 2
    2
      web_src/js/features/repo-issue-content.js
  76. 18
    17
      web_src/js/features/repo-issue.js
  77. 21
    20
      web_src/js/features/repo-legacy.js
  78. 13
    12
      web_src/js/features/repo-migrate.js
  79. 4
    3
      web_src/js/features/repo-migration.js
  80. 2
    1
      web_src/js/features/repo-release.js
  81. 5
    4
      web_src/js/features/repo-template.js
  82. 9
    8
      web_src/js/features/repo-unicode-escape.js
  83. 7
    4
      web_src/js/features/user-auth-webauthn.js
  84. 3
    2
      web_src/js/features/user-auth.js
  85. 5
    4
      web_src/js/features/user-settings.js
  86. 65
    0
      web_src/js/utils/dom.js
  87. 0
    5
      web_src/less/_base.less
  88. 0
    12
      web_src/less/_repository.less
  89. 11
    1
      web_src/less/helpers.less

+ 3
- 3
.eslintrc.yaml View File

jquery/no-global-eval: [2] jquery/no-global-eval: [2]
jquery/no-grep: [2] jquery/no-grep: [2]
jquery/no-has: [2] jquery/no-has: [2]
jquery/no-hide: [0]
jquery/no-hide: [2]
jquery/no-html: [0] jquery/no-html: [0]
jquery/no-in-array: [2] jquery/no-in-array: [2]
jquery/no-is-array: [2] jquery/no-is-array: [2]
jquery/no-proxy: [2] jquery/no-proxy: [2]
jquery/no-ready: [0] jquery/no-ready: [0]
jquery/no-serialize: [2] jquery/no-serialize: [2]
jquery/no-show: [0]
jquery/no-show: [2]
jquery/no-size: [2] jquery/no-size: [2]
jquery/no-sizzle: [0] jquery/no-sizzle: [0]
jquery/no-slide: [0] jquery/no-slide: [0]
jquery/no-submit: [0] jquery/no-submit: [0]
jquery/no-text: [0] jquery/no-text: [0]
jquery/no-toggle: [0]
jquery/no-toggle: [2]
jquery/no-trigger: [0] jquery/no-trigger: [0]
jquery/no-trim: [2] jquery/no-trim: [2]
jquery/no-val: [0] jquery/no-val: [0]

+ 5
- 0
docs/content/doc/developers/guidelines-frontend.en-us.md View File

* `node.dataset` should not be used, use `node.getAttribute` instead. * `node.dataset` should not be used, use `node.getAttribute` instead.
* never bind any user data to a DOM node, use a suitable design pattern to describe the relation between node and data. * never bind any user data to a DOM node, use a suitable design pattern to describe the relation between node and data.


### Show/Hide Elements

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

### Legacy Code ### Legacy Code


A lot of legacy code already existed before this document's written. It's recommended to refactor legacy code to follow the guidelines. A lot of legacy code already existed before this document's written. It's recommended to refactor legacy code to follow the guidelines.

+ 3
- 3
templates/admin/auth/edit.tmpl View File

<label for="port">{{.locale.Tr "admin.auths.port"}}</label> <label for="port">{{.locale.Tr "admin.auths.port"}}</label>
<input id="port" name="port" value="{{$cfg.Port}}" placeholder="e.g. 636" required> <input id="port" name="port" value="{{$cfg.Port}}" placeholder="e.g. 636" required>
</div> </div>
<div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> <label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
<input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}> <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>
<input id="use_paged_search" name="use_paged_search" type="checkbox" {{if $cfg.UsePagedSearch}}checked{{end}}> <input id="use_paged_search" name="use_paged_search" type="checkbox" {{if $cfg.UsePagedSearch}}checked{{end}}>
</div> </div>
</div> </div>
<div class="field required search-page-size{{if not $cfg.UsePagedSearch}} hide{{end}}">
<div class="field required search-page-size{{if not $cfg.UsePagedSearch}} gt-hidden{{end}}">
<label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label> <label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label>
<input id="search_page_size" name="search_page_size" value="{{if $cfg.UsePagedSearch}}{{$cfg.SearchPageSize}}{{end}}"> <input id="search_page_size" name="search_page_size" value="{{if $cfg.UsePagedSearch}}{{$cfg.SearchPageSize}}{{end}}">
</div> </div>
</div> </div>
<p class="help">{{.locale.Tr "admin.auths.force_smtps_helper"}}</p> <p class="help">{{.locale.Tr "admin.auths.force_smtps_helper"}}</p>
</div> </div>
<div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> <label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
<input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}> <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}>

+ 3
- 3
templates/admin/auth/new.tmpl View File

{{template "admin/auth/source/smtp" .}} {{template "admin/auth/source/smtp" .}}


<!-- PAM --> <!-- PAM -->
<div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
<div class="pam required field {{if not (eq .type 4)}}gt-hidden{{end}}">
<label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label> <label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label>
<input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" /> <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}" />
<label for="pam_email_domain">{{.locale.Tr "admin.auths.pam_email_domain"}}</label> <label for="pam_email_domain">{{.locale.Tr "admin.auths.pam_email_domain"}}</label>
<input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}"> <input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}">
</div> </div>
<div class="pam optional field {{if not (eq .type 4)}}hide{{end}}">
<div class="pam optional field {{if not (eq .type 4)}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> <label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}> <input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
<input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}> <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
</div> </div>
</div> </div>
<div class="ldap inline field {{if not (eq .type 2)}}hide{{end}}">
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.syncenabled"}}</strong></label> <label><strong>{{.locale.Tr "admin.auths.syncenabled"}}</strong></label>
<input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}> <input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>

+ 7
- 7
templates/admin/auth/source/ldap.tmpl View File

<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}hide{{end}}">
<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}gt-hidden{{end}}">
<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
<label>{{.locale.Tr "admin.auths.security_protocol"}}</label> <label>{{.locale.Tr "admin.auths.security_protocol"}}</label>
<div class="ui selection security-protocol dropdown"> <div class="ui selection security-protocol dropdown">
<label for="port">{{.locale.Tr "admin.auths.port"}}</label> <label for="port">{{.locale.Tr "admin.auths.port"}}</label>
<input id="port" name="port" value="{{.port}}" placeholder="e.g. 636"> <input id="port" name="port" value="{{.port}}" placeholder="e.g. 636">
</div> </div>
<div class="has-tls inline field {{if not .HasTLS}}hide{{end}}">
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> <label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
<input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}> <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
</div> </div>
</div> </div>
<div class="ldap field {{if not (eq .type 2)}}hide{{end}}">
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
<label for="bind_dn">{{.locale.Tr "admin.auths.bind_dn"}}</label> <label for="bind_dn">{{.locale.Tr "admin.auths.bind_dn"}}</label>
<input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com"> <input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="e.g. cn=Search,dc=mydomain,dc=com">
</div> </div>
<div class="ldap field {{if not (eq .type 2)}}hide{{end}}">
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
<label for="bind_password">{{.locale.Tr "admin.auths.bind_password"}}</label> <label for="bind_password">{{.locale.Tr "admin.auths.bind_password"}}</label>
<input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}"> <input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}">
</div> </div>
<label for="user_base">{{.locale.Tr "admin.auths.user_base"}}</label> <label for="user_base">{{.locale.Tr "admin.auths.user_base"}}</label>
<input id="user_base" name="user_base" value="{{.user_base}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com"> <input id="user_base" name="user_base" value="{{.user_base}}" placeholder="e.g. ou=Users,dc=mydomain,dc=com">
</div> </div>
<div class="dldap required field {{if not (eq .type 5)}}hide{{end}}">
<div class="dldap required field {{if not (eq .type 5)}}gt-hidden{{end}}">
<label for="user_dn">{{.locale.Tr "admin.auths.user_dn"}}</label> <label for="user_dn">{{.locale.Tr "admin.auths.user_dn"}}</label>
<input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com"> <input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="e.g. uid=%s,ou=Users,dc=mydomain,dc=com">
</div> </div>
</div> </div>
<!-- ldap group end --> <!-- ldap group end -->


<div class="ldap inline field {{if not (eq .type 2)}}hide{{end}}">
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
<div class="ui checkbox"> <div class="ui checkbox">
<label for="use_paged_search"><strong>{{.locale.Tr "admin.auths.use_paged_search"}}</strong></label> <label for="use_paged_search"><strong>{{.locale.Tr "admin.auths.use_paged_search"}}</strong></label>
<input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}> <input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}>
</div> </div>
</div> </div>
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}hide{{end}}">
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}gt-hidden{{end}}">
<label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label> <label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label>
<input id="search_page_size" name="search_page_size" value="{{.search_page_size}}"> <input id="search_page_size" name="search_page_size" value="{{.search_page_size}}">
</div> </div>

+ 1
- 1
templates/admin/auth/source/oauth.tmpl View File

<div class="oauth2 field {{if not (eq .type 6)}}hide{{end}}">
<div class="oauth2 field {{if not (eq .type 6)}}gt-hidden{{end}}">
<div class="inline required field"> <div class="inline required field">
<label>{{.locale.Tr "admin.auths.oauth2_provider"}}</label> <label>{{.locale.Tr "admin.auths.oauth2_provider"}}</label>
<div class="ui selection type dropdown"> <div class="ui selection type dropdown">

+ 1
- 1
templates/admin/auth/source/smtp.tmpl View File

<div class="smtp field {{if not (eq .type 3)}}hide{{end}}">
<div class="smtp field {{if not (eq .type 3)}}gt-hidden{{end}}">
<div class="inline required field"> <div class="inline required field">
<label>{{.locale.Tr "admin.auths.smtp_auth"}}</label> <label>{{.locale.Tr "admin.auths.smtp_auth"}}</label>
<div class="ui selection type dropdown"> <div class="ui selection type dropdown">

+ 1
- 1
templates/admin/auth/source/sspi.tmpl View File

<div class="sspi field {{if not (eq .type 7)}}hide{{end}}">
<div class="sspi field {{if not (eq .type 7)}}gt-hidden{{end}}">
<div class="field"> <div class="field">
<div class="ui checkbox"> <div class="ui checkbox">
<label for="sspi_auto_create_users"><strong>{{.locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label> <label for="sspi_auto_create_users"><strong>{{.locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label>

+ 3
- 3
templates/admin/user/edit.tmpl View File

</div> </div>
</div> </div>


<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}hide{{end}}">
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}gt-hidden{{end}}">
<label for="login_name">{{.locale.Tr "admin.users.auth_login_name"}}</label> <label for="login_name">{{.locale.Tr "admin.users.auth_login_name"}}</label>
<input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus> <input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus>
</div> </div>
<label for="email">{{.locale.Tr "email"}}</label> <label for="email">{{.locale.Tr "email"}}</label>
<input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required> <input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required>
</div> </div>
<div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}hide{{end}}">
<div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}gt-hidden{{end}}">
<label for="password">{{.locale.Tr "password"}}</label> <label for="password">{{.locale.Tr "password"}}</label>
<input id="password" name="password" type="password" autocomplete="new-password"> <input id="password" name="password" type="password" autocomplete="new-password">
<p class="help">{{.locale.Tr "admin.users.password_helper"}}</p> <p class="help">{{.locale.Tr "admin.users.password_helper"}}</p>
<input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}> <input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}>
</div> </div>
</div> </div>
<div class="inline field"{{if DisableGitHooks}} hidden{{end}}>
<div class="inline field {{if DisableGitHooks}}gt-hidden{{end}}">
<div class="ui checkbox tooltip" data-content="{{.locale.Tr "admin.users.allow_git_hook_tooltip"}}"> <div class="ui checkbox tooltip" data-content="{{.locale.Tr "admin.users.allow_git_hook_tooltip"}}">
<label><strong>{{.locale.Tr "admin.users.allow_git_hook"}}</strong></label> <label><strong>{{.locale.Tr "admin.users.allow_git_hook"}}</strong></label>
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}> <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}>

+ 5
- 5
templates/install.tmpl View File

</div> </div>
</div> </div>


<div class="hide" data-db-setting-for="common-host">
<div class="gt-hidden" data-db-setting-for="common-host">
<div class="inline required field {{if .Err_DbSetting}}error{{end}}"> <div class="inline required field {{if .Err_DbSetting}}error{{end}}">
<label for="db_host">{{.locale.Tr "install.host"}}</label> <label for="db_host">{{.locale.Tr "install.host"}}</label>
<input id="db_host" name="db_host" value="{{.db_host}}"> <input id="db_host" name="db_host" value="{{.db_host}}">
</div> </div>
</div> </div>


<div class="hide" data-db-setting-for="postgres">
<div class="gt-hidden" data-db-setting-for="postgres">
<div class="inline required field"> <div class="inline required field">
<label>{{.locale.Tr "install.ssl_mode"}}</label> <label>{{.locale.Tr "install.ssl_mode"}}</label>
<div class="ui selection database type dropdown"> <div class="ui selection database type dropdown">
</div> </div>
</div> </div>


<div class="hide" data-db-setting-for="mysql">
<div class="gt-hidden" data-db-setting-for="mysql">
<div class="inline required field"> <div class="inline required field">
<label>{{.locale.Tr "install.charset"}}</label> <label>{{.locale.Tr "install.charset"}}</label>
<div class="ui selection database type dropdown"> <div class="ui selection database type dropdown">
</div> </div>
</div> </div>


<div class="hide" data-db-setting-for="sqlite3">
<div class="gt-hidden" data-db-setting-for="sqlite3">
<div class="inline required field {{if or .Err_DbPath .Err_DbSetting}}error{{end}}"> <div class="inline required field {{if or .Err_DbPath .Err_DbSetting}}error{{end}}">
<label for="db_path">{{.locale.Tr "install.path"}}</label> <label for="db_path">{{.locale.Tr "install.path"}}</label>
<input id="db_path" name="db_path" value="{{.db_path}}"> <input id="db_path" name="db_path" value="{{.db_path}}">
</div> </div>
</div> </div>
</div> </div>
<img style="display: none" src="{{AssetUrlPrefix}}/img/loading.png"/>
<img class="gt-hidden" src="{{AssetUrlPrefix}}/img/loading.png"/>
{{template "base/footer" .}} {{template "base/footer" .}}

+ 2
- 2
templates/org/settings/options.tmpl View File

{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_Name}}error{{end}}"> <div class="required field {{if .Err_Name}}error{{end}}">
<label for="org_name">{{.locale.Tr "org.org_name_holder"}} <label for="org_name">{{.locale.Tr "org.org_name_holder"}}
<span class="text red hide" id="org-name-change-prompt"> {{.locale.Tr "org.settings.change_orgname_prompt"}}</span>
<span class="text red hide" id="org-name-change-redirect-prompt"> {{.locale.Tr "org.settings.change_orgname_redirect_prompt"}}</span>
<span class="text red gt-hidden" id="org-name-change-prompt"> {{.locale.Tr "org.settings.change_orgname_prompt"}}</span>
<span class="text red gt-hidden" id="org-name-change-redirect-prompt"> {{.locale.Tr "org.settings.change_orgname_redirect_prompt"}}</span>
</label> </label>
<input id="org_name" name="name" value="{{.Org.Name}}" data-org-name="{{.Org.Name}}" autofocus required> <input id="org_name" name="name" value="{{.Org.Name}}" data-org-name="{{.Org.Name}}" autofocus required>
</div> </div>

+ 1
- 1
templates/org/team/new.tmpl View File

</div> </div>
<div class="ui divider"></div> <div class="ui divider"></div>


<div class="team-units required grouped field"{{if eq .Team.AccessMode 3}} style="display: none"{{end}}>
<div class="team-units required grouped field {{if eq .Team.AccessMode 3}}gt-hidden{{end}}">
<label>{{.locale.Tr "org.team_unit_desc"}}</label> <label>{{.locale.Tr "org.team_unit_desc"}}</label>
<table class="ui celled table"> <table class="ui celled table">
<thead> <thead>

+ 1
- 1
templates/repo/blame.tmpl View File

<a class="ui tiny button" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{.locale.Tr "repo.normal_view"}}</a> <a class="ui tiny button" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{.locale.Tr "repo.normal_view"}}</a>
<a class="ui tiny button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{.locale.Tr "repo.file_history"}}</a> <a class="ui tiny button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{.locale.Tr "repo.file_history"}}</a>
<a class="ui tiny button unescape-button">{{.locale.Tr "repo.unescape_control_characters"}}</a> <a class="ui tiny button unescape-button">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui tiny button escape-button" style="display: none;">{{.locale.Tr "repo.escape_control_characters"}}</a>
<a class="ui tiny button escape-button gt-hidden">{{.locale.Tr "repo.escape_control_characters"}}</a>
</div> </div>
</div> </div>
</h4> </h4>

+ 1
- 1
templates/repo/branch_dropdown.tmpl View File

</span> </span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}}
</button> </button>
<div class="data" style="display: none" data-mode="{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}">
<div class="data gt-hidden" data-mode="{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}">
{{if $showBranchesInDropdown}} {{if $showBranchesInDropdown}}
{{range .root.Branches}} {{range .root.Branches}}
<div class="item branch {{if eq $defaultBranch .}}selected{{end}}" data-url="{{PathEscapeSegments .}}">{{.}}</div> <div class="item branch {{if eq $defaultBranch .}}selected{{end}}" data-url="{{PathEscapeSegments .}}">{{.}}</div>

+ 1
- 1
templates/repo/commits_list.tmpl View File

{{end}} {{end}}
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
{{if IsMultilineCommitMessage .Message}} {{if IsMultilineCommitMessage .Message}}
<pre class="commit-body" style="display: none;">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
{{end}} {{end}}
</td> </td>
{{if .Committer}} {{if .Committer}}

+ 1
- 1
templates/repo/commits_list_small.tmpl View File

<button class="ui button ellipsis-button" aria-expanded="false">...</button> <button class="ui button ellipsis-button" aria-expanded="false">...</button>
{{end}} {{end}}
{{if IsMultilineCommitMessage .Message}} {{if IsMultilineCommitMessage .Message}}
<pre class="commit-body" style="display: none;">{{RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}}</pre>
<pre class="commit-body gt-hidden">{{RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}}</pre>
{{end}} {{end}}
</div> </div>
{{end}} {{end}}

+ 1
- 1
templates/repo/create.tmpl View File

</div> </div>
</div> </div>


<div id="template_units" style="display: none;">
<div id="template_units" class="gt-hidden">
<div class="inline field"> <div class="inline field">
<label>{{.locale.Tr "repo.template.items"}}</label> <label>{{.locale.Tr "repo.template.items"}}</label>
<div class="ui checkbox"> <div class="ui checkbox">

+ 4
- 4
templates/repo/diff/box.tmpl View File

</script> </script>
<div id="diff-file-list"></div> <div id="diff-file-list"></div>
<div id="diff-container"> <div id="diff-container">
<div id="diff-file-tree" class="hide"></div>
<div id="diff-file-tree" class="gt-hidden"></div>
<div id="diff-file-boxes" class="sixteen wide column"> <div id="diff-file-boxes" class="sixteen wide column">
{{range $i, $file := .Diff.Files}} {{range $i, $file := .Diff.Files}}
{{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}} {{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}
{{end}} {{end}}
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
<a class="ui basic tiny button unescape-button">{{$.locale.Tr "repo.unescape_control_characters"}}</a> <a class="ui basic tiny button unescape-button">{{$.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui basic tiny button escape-button" style="display: none;">{{$.locale.Tr "repo.escape_control_characters"}}</a>
<a class="ui basic tiny button escape-button gt-hidden">{{$.locale.Tr "repo.escape_control_characters"}}</a>
{{end}} {{end}}
{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
{{if $file.IsDeleted}} {{if $file.IsDeleted}}
</div> </div>
</h4> </h4>
<div class="diff-file-body ui attached unstackable table segment" {{if $file.IsViewed}}data-folded="true"{{end}}> <div class="diff-file-body ui attached unstackable table segment" {{if $file.IsViewed}}data-folded="true"{{end}}>
<div id="diff-source-{{$file.NameHash}}" class="file-body file-code unicode-escaped code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} hide{{end}}">
<div id="diff-source-{{$file.NameHash}}" class="file-body file-code unicode-escaped code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} gt-hidden{{end}}">
{{if or $file.IsIncomplete $file.IsBin}} {{if or $file.IsIncomplete $file.IsBin}}
<div class="diff-file-body binary" style="padding: 5px 10px;"> <div class="diff-file-body binary" style="padding: 5px 10px;">
{{if $file.IsIncomplete}} {{if $file.IsIncomplete}}
</div> </div>


{{if not $.Repository.IsArchived}} {{if not $.Repository.IsArchived}}
<div class="hide" id="edit-content-form">
<div class="gt-hidden" id="edit-content-form">
<div class="ui comment form"> <div class="ui comment form">
<div class="ui top attached tabular menu"> <div class="ui top attached tabular menu">
<a class="active write item">{{$.locale.Tr "write"}}</a> <a class="active write item">{{$.locale.Tr "write"}}</a>

+ 1
- 1
templates/repo/diff/comment_form.tmpl View File

{{if and $.root.SignedUserID (not $.Repository.IsArchived)}} {{if and $.root.SignedUserID (not $.Repository.IsArchived)}}
<form class="ui form {{if $.hidden}}hide comment-form comment-form-reply{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
<form class="ui form {{if $.hidden}}gt-hidden comment-form comment-form-reply{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
{{$.root.CsrfTokenHtml}} {{$.root.CsrfTokenHtml}}
<input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}"> <input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
<input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"/> <input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"/>

+ 2
- 2
templates/repo/diff/comments.tmpl View File

<span class="no-content">{{$.root.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{$.root.locale.Tr "repo.issues.no_content"}}</span>
{{end}} {{end}}
</div> </div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
</div> </div>
{{$reactions := .Reactions.GroupByType}} {{$reactions := .Reactions.GroupByType}}
{{if $reactions}} {{if $reactions}}

+ 6
- 6
templates/repo/diff/compare.tmpl View File

{{end}} {{end}}
{{end}} {{end}}
</div> </div>
<div class="scrolling menu reference-list-menu base-tag-list" style="display: none">
<div class="scrolling menu reference-list-menu base-tag-list gt-hidden">
{{range .Tags}} {{range .Tags}}
<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div> <div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div>
{{end}} {{end}}
{{end}} {{end}}
{{end}} {{end}}
</div> </div>
<div class="scrolling menu reference-list-menu head-tag-list" style="display: none">
<div class="scrolling menu reference-list-menu head-tag-list gt-hidden">
{{range .HeadTags}} {{range .HeadTags}}
<div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments .}}">{{$HeadCompareName}}:{{.}}</div> <div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments .}}">{{$HeadCompareName}}:{{.}}</div>
{{end}} {{end}}
{{if .IsNothingToCompare}} {{if .IsNothingToCompare}}
{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}} {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
<div class="ui segment">{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div> <div class="ui segment">{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div>
<div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}}>
<div class="ui info message show-form-container {{if .Flash}}gt-hidden{{end}}">
<button class="ui button green show-form">{{.locale.Tr "repo.pulls.new"}}</button> <button class="ui button green show-form">{{.locale.Tr "repo.pulls.new"}}</button>
</div> </div>
<div class="pullrequest-form" {{if not .Flash}}style="display: none"{{end}}>
<div class="pullrequest-form {{if not .Flash}}gt-hidden{{end}}">
{{template "repo/issue/new_form" .}} {{template "repo/issue/new_form" .}}
</div> </div>
{{else}} {{else}}
</div> </div>
{{else}} {{else}}
{{if and $.IsSigned (not .Repository.IsArchived)}} {{if and $.IsSigned (not .Repository.IsArchived)}}
<div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}}>
<div class="ui info message show-form-container {{if .Flash}}gt-hidden{{end}}">
<button class="ui button green show-form">{{.locale.Tr "repo.pulls.new"}}</button> <button class="ui button green show-form">{{.locale.Tr "repo.pulls.new"}}</button>
</div> </div>
{{else if .Repository.IsArchived}} {{else if .Repository.IsArchived}}
</div> </div>
{{end}} {{end}}
{{if $.IsSigned}} {{if $.IsSigned}}
<div class="pullrequest-form" {{if not .Flash}}style="display: none"{{end}}>
<div class="pullrequest-form {{if not .Flash}}gt-hidden{{end}}">
{{template "repo/issue/new_form" .}} {{template "repo/issue/new_form" .}}
</div> </div>
{{end}} {{end}}

+ 2
- 2
templates/repo/diff/conversation.tmpl View File

{{svg "octicon-unfold" 16 "gt-mr-3"}} {{svg "octicon-unfold" 16 "gt-mr-3"}}
{{$.locale.Tr "repo.issues.review.show_resolved"}} {{$.locale.Tr "repo.issues.review.show_resolved"}}
</button> </button>
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="hide ui tiny right labeled button hide-outdated gt-df gt-ac">
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="ui tiny right labeled button hide-outdated gt-df gt-ac gt-hidden">
{{svg "octicon-fold" 16 "gt-mr-3"}} {{svg "octicon-fold" 16 "gt-mr-3"}}
{{$.locale.Tr "repo.issues.review.hide_resolved"}} {{$.locale.Tr "repo.issues.review.hide_resolved"}}
</button> </button>
</div> </div>
</div> </div>
{{end}} {{end}}
<div id="code-comments-{{(index .comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}hide{{end}}">
<div id="code-comments-{{(index .comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}gt-hidden{{end}}">
<div class="comment-list"> <div class="comment-list">
<ui class="ui comments"> <ui class="ui comments">
{{template "repo/diff/comments" dict "root" $ "comments" .comments}} {{template "repo/diff/comments" dict "root" $ "comments" .comments}}

+ 1
- 1
templates/repo/diff/image_diff.tmpl View File

{{end}} {{end}}
</div> </div>
</div> </div>
<div class="hide">
<div class="gt-hidden">
<div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}"> <div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}">
<div class="diff-side-by-side"> <div class="diff-side-by-side">
{{if .blobBase}} {{if .blobBase}}

+ 1
- 1
templates/repo/editor/edit.tmpl View File

{{end}} {{end}}
</div> </div>
<div class="ui bottom attached active tab segment" data-tab="write"> <div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="edit_area" name="content" class="hide" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
<textarea id="edit_area" name="content" class="gt-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
data-url="{{.Repository.Link}}/markdown" data-url="{{.Repository.Link}}/markdown"
data-context="{{.RepoLink}}" data-context="{{.RepoLink}}"
data-markdown-file-exts="{{.MarkdownFileExts}}" data-markdown-file-exts="{{.MarkdownFileExts}}"

+ 1
- 1
templates/repo/editor/patch.tmpl View File

<a class="active item" data-tab="write">{{svg "octicon-code" 16 "gt-mr-2"}}{{.locale.Tr "repo.editor.new_patch"}}</a> <a class="active item" data-tab="write">{{svg "octicon-code" 16 "gt-mr-2"}}{{.locale.Tr "repo.editor.new_patch"}}</a>
</div> </div>
<div class="ui bottom attached active tab segment" data-tab="write"> <div class="ui bottom attached active tab segment" data-tab="write">
<textarea id="edit_area" name="content" class="hide" data-id="repo-{{.Repository.Name}}-patch"
<textarea id="edit_area" name="content" class="gt-hidden" data-id="repo-{{.Repository.Name}}-patch"
data-context="{{.RepoLink}}" data-context="{{.RepoLink}}"
data-line-wrap-extensions="{{.LineWrapExtensions}}"> data-line-wrap-extensions="{{.LineWrapExtensions}}">
{{.FileContent}}</textarea> {{.FileContent}}</textarea>

+ 1
- 1
templates/repo/find/files.tmpl View File

<tbody> <tbody>
</tbody> </tbody>
</table> </table>
<div id="repo-find-file-no-result" class="ui row center gt-mt-5" hidden>
<div id="repo-find-file-no-result" class="ui row center gt-mt-5 gt-hidden">
<h3>{{.locale.Tr "repo.find_file.no_matching"}}</h3> <h3>{{.locale.Tr "repo.find_file.no_matching"}}</h3>
</div> </div>
</div> </div>

+ 1
- 1
templates/repo/graph.tmpl View File

</div> </div>
</h2> </h2>
<div class="ui dividing"></div> <div class="ui dividing"></div>
<div class="ui segment loading hide" id="loading-indicator"></div>
<div class="ui segment loading gt-hidden" id="loading-indicator"></div>
{{template "repo/graph/svgcontainer" .}} {{template "repo/graph/svgcontainer" .}}
{{template "repo/graph/commits" .}} {{template "repo/graph/commits" .}}
</div> </div>

+ 2
- 2
templates/repo/home.tmpl View File

</div> </div>
{{end}} {{end}}
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
<div class="ui repo-topic-edit grid form" id="topic_edit" style="display:none">
<div class="ui repo-topic-edit grid form gt-hidden" id="topic_edit">
<div class="fourteen wide column"> <div class="fourteen wide column">
<div class="field"> <div class="field">
<div class="ui fluid multiple search selection dropdown"> <div class="ui fluid multiple search selection dropdown">
</div> </div>
</div> </div>
{{end}} {{end}}
<div class="hide" id="validate_prompt">
<div class="gt-hidden" id="validate_prompt">
<span id="count_prompt">{{.locale.Tr "repo.topic.count_prompt"}}</span> <span id="count_prompt">{{.locale.Tr "repo.topic.count_prompt"}}</span>
<span id="format_prompt">{{.locale.Tr "repo.topic.format_prompt"}}</span> <span id="format_prompt">{{.locale.Tr "repo.topic.format_prompt"}}</span>
</div> </div>

+ 1
- 1
templates/repo/issue/branch_selector_field.tmpl View File

<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div> <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div>
{{end}} {{end}}
</div> </div>
<div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}" style="display: none">
<div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}} gt-hidden">
{{if .Reference}} {{if .Reference}}
<div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.locale.Tr "repo.clear_ref"}}</a></strong></div> <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.locale.Tr "repo.clear_ref"}}</a></strong></div>
{{end}} {{end}}

+ 1
- 1
templates/repo/issue/labels/label.tmpl View File

<a <a
class="item {{if not .label.IsChecked}}hide{{end}}"
class="item {{if not .label.IsChecked}}gt-hidden{{end}}"
id="label_{{.label.ID}}" id="label_{{.label.ID}}"
href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}}
> >

+ 1
- 1
templates/repo/issue/labels/labels_sidebar.tmpl View File

<div class="ui labels list"> <div class="ui labels list">
<span class="no-select item {{if .ctx.HasSelectedLabel}}hide{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span>
<span class="no-select item {{if .ctx.HasSelectedLabel}}gt-hidden{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span>
<span class="labels-list"> <span class="labels-list">
{{range .ctx.Labels}} {{range .ctx.Labels}}
{{template "repo/issue/labels/label" dict "root" $.root "label" .}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}}

+ 1
- 1
templates/repo/issue/list.tmpl View File

</div> </div>
</div> </div>
</div> </div>
<div id="issue-actions" class="ui stackable grid hide">
<div id="issue-actions" class="ui stackable grid gt-hidden">
<div class="six wide column"> <div class="six wide column">
{{template "repo/issue/openclose" .}} {{template "repo/issue/openclose" .}}
</div> </div>

+ 1
- 1
templates/repo/issue/milestone_issues.tmpl View File

</div> </div>
</div> </div>
</div> </div>
<div id="issue-actions" class="ui stackable grid hide">
<div id="issue-actions" class="ui stackable grid gt-hidden">
<div class="six wide column"> <div class="six wide column">
{{template "repo/issue/openclose" .}} {{template "repo/issue/openclose" .}}
</div> </div>

+ 4
- 4
templates/repo/issue/new_form.tmpl View File

</div> </div>
</div> </div>
<div class="ui select-milestone list"> <div class="ui select-milestone list">
<span class="no-select item {{if .Milestone}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span>
<span class="no-select item {{if .Milestone}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span>
<div class="selected"> <div class="selected">
{{if .Milestone}} {{if .Milestone}}
<a class="item muted sidebar-item-link" href="{{.RepoLink}}/issues?milestone={{.Milestone.ID}}"> <a class="item muted sidebar-item-link" href="{{.RepoLink}}/issues?milestone={{.Milestone.ID}}">
</div> </div>
</div> </div>
<div class="ui select-project list"> <div class="ui select-project list">
<span class="no-select item {{if .Project}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span>
<span class="no-select item {{if .Project}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span>
<div class="selected"> <div class="selected">
{{if .Project}} {{if .Project}}
<a class="item muted sidebar-item-link" href="{{.RepoLink}}/projects/{{.Project.ID}}"> <a class="item muted sidebar-item-link" href="{{.RepoLink}}/projects/{{.Project.ID}}">
</div> </div>
</div> </div>
<div class="ui assignees list"> <div class="ui assignees list">
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">
<span class="no-select item {{if .HasSelectedLabel}}gt-hidden{{end}}">
{{.locale.Tr "repo.issues.new.no_assignees"}} {{.locale.Tr "repo.issues.new.no_assignees"}}
</span> </span>
{{range .Assignees}} {{range .Assignees}}
<a class="hide item gt-p-2 muted" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
<a class="item gt-p-2 muted gt-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
{{avatar $.Context . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}} {{avatar $.Context . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}}
</a> </a>
{{end}} {{end}}

+ 4
- 4
templates/repo/issue/view_content.tmpl View File

<span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span>
{{end}} {{end}}
</div> </div>
<div id="issue-{{.Issue.ID}}-raw" class="raw-content hide">{{.Issue.Content}}</div>
<div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
<div id="issue-{{.Issue.ID}}-raw" class="raw-content gt-hidden">{{.Issue.Content}}</div>
<div class="edit-content-zone gt-hidden" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
{{if .Issue.Attachments}} {{if .Issue.Attachments}}
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
{{end}} {{end}}
{{template "repo/issue/view_content/sidebar" .}} {{template "repo/issue/view_content/sidebar" .}}
</div> </div>


<div class="hide" id="edit-content-form">
<div class="gt-hidden" id="edit-content-form">
<div class="ui comment form"> <div class="ui comment form">
<div class="ui top tabular menu"> <div class="ui top tabular menu">
<a class="active write item">{{$.locale.Tr "write"}}</a> <a class="active write item">{{$.locale.Tr "write"}}</a>


{{template "repo/issue/view_content/reference_issue_dialog" .}} {{template "repo/issue/view_content/reference_issue_dialog" .}}


<div class="hide" id="no-content">
<div class="gt-hidden" id="no-content">
<span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span>
</div> </div>



+ 6
- 6
templates/repo/issue/view_content/comments.tmpl View File

<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
{{end}} {{end}}
</div> </div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
{{if .Attachments}} {{if .Attachments}}
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
{{end}} {{end}}
<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
{{end}} {{end}}
</div> </div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
{{if .Attachments}} {{if .Attachments}}
{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
{{end}} {{end}}
<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
{{end}} {{end}}
</div> </div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
<div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div>
<div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
</div> </div>
{{$reactions := .Reactions.GroupByType}} {{$reactions := .Reactions.GroupByType}}
{{if $reactions}} {{if $reactions}}

+ 1
- 1
templates/repo/issue/view_content/pull.tmpl View File



{{if $.StillCanManualMerge}} {{if $.StillCanManualMerge}}
<div class="ui divider"></div> <div class="ui divider"></div>
<div class="ui form manually-merged-fields" style="display: none">
<div class="ui form manually-merged-fields gt-hidden">
<form action="{{.Link}}/merge" method="post"> <form action="{{.Link}}/merge" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field"> <div class="field">

+ 1
- 1
templates/repo/issue/view_content/pull_merge_instruction.tmpl View File

<div class="ui divider"></div> <div class="ui divider"></div>
<div class="instruct-toggle"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div> <div class="instruct-toggle"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div>
<div class="instruct-content gt-mt-3" style="display:none">
<div class="instruct-content gt-mt-3 gt-hidden">
<div><h3 class="gt-di">{{$.locale.Tr "step1"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div> <div><h3 class="gt-di">{{$.locale.Tr "step1"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div>
<div class="ui secondary segment"> <div class="ui secondary segment">
{{if eq $.Issue.PullRequest.Flow 0}} {{if eq $.Issue.PullRequest.Flow 0}}

+ 6
- 6
templates/repo/issue/view_content/sidebar.tmpl View File

</div> </div>


<div class="ui assignees list"> <div class="ui assignees list">
<span class="no-select item {{if or .OriginalReviews .PullReviewers}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_reviewers"}}</span>
<span class="no-select item {{if or .OriginalReviews .PullReviewers}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_reviewers"}}</span>
<div class="selected"> <div class="selected">
{{range .PullReviewers}} {{range .PullReviewers}}
<div class="item gt-mb-2"> <div class="item gt-mb-2">
</div> </div>
</div> </div>
<div class="ui select-milestone list"> <div class="ui select-milestone list">
<span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span>
<span class="no-select item {{if .Issue.Milestone}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span>
<div class="selected"> <div class="selected">
{{if .Issue.Milestone}} {{if .Issue.Milestone}}
<a class="item muted sidebar-item-link" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}"> <a class="item muted sidebar-item-link" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}">
</div> </div>
</div> </div>
<div class="ui select-project list"> <div class="ui select-project list">
<span class="no-select item {{if .Issue.ProjectID}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span>
<span class="no-select item {{if .Issue.ProjectID}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span>
<div class="selected"> <div class="selected">
{{if .Issue.ProjectID}} {{if .Issue.ProjectID}}
<a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}"> <a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}">
</div> </div>
</div> </div>
<div class="ui assignees list"> <div class="ui assignees list">
<span class="no-select item {{if .Issue.Assignees}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_assignees"}}</span>
<span class="no-select item {{if .Issue.Assignees}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_assignees"}}</span>
<div class="selected"> <div class="selected">
{{range .Issue.Assignees}} {{range .Issue.Assignees}}
<div class="item"> <div class="item">
<div class="ui divider"></div> <div class="ui divider"></div>
<span class="text"><strong>{{.locale.Tr "repo.issues.due_date"}}</strong></span> <span class="text"><strong>{{.locale.Tr "repo.issues.due_date"}}</strong></span>
<div class="ui form" id="deadline-loader"> <div class="ui form" id="deadline-loader">
<div class="ui negative message" id="deadline-err-invalid-date" style="display: none;">
<div class="ui negative message gt-hidden" id="deadline-err-invalid-date">
{{svg "octicon-x" 16 "close icon"}} {{svg "octicon-x" 16 "close icon"}}
{{.locale.Tr "repo.issues.due_date_invalid"}} {{.locale.Tr "repo.issues.due_date_invalid"}}
</div> </div>
{{end}} {{end}}


{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
<div {{if ne .Issue.DeadlineUnix 0}} style="display: none;"{{end}} id="deadlineForm">
<div {{if ne .Issue.DeadlineUnix 0}} class="gt-hidden"{{end}} id="deadlineForm">
<form class="ui fluid action input issue-due-form" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline" method="post" id="update-issue-deadline-form"> <form class="ui fluid action input issue-due-form" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline" method="post" id="update-issue-deadline-form">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input required placeholder="{{.locale.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.Format "2006-01-02"}}"{{end}} type="date" name="deadlineDate" id="deadlineDate"> <input required placeholder="{{.locale.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.Format "2006-01-02"}}"{{end}} type="date" name="deadlineDate" id="deadlineDate">

+ 4
- 4
templates/repo/issue/view_title.tmpl View File

<h1> <h1>
<span id="issue-title">{{RenderIssueTitle $.Context .Issue.Title $.RepoLink $.Repository.ComposeMetas | RenderCodeBlock}}</span> <span id="issue-title">{{RenderIssueTitle $.Context .Issue.Title $.RepoLink $.Repository.ComposeMetas | RenderCodeBlock}}</span>
<span class="index">#{{.Issue.Index}}</span> <span class="index">#{{.Issue.Index}}</span>
<div id="edit-title-input" class="ui input gt-ml-4" style="display: none">
<div id="edit-title-input" class="ui input gt-ml-4 gt-hidden">
<input value="{{.Issue.Title}}" maxlength="255" autocomplete="off"> <input value="{{.Issue.Title}}" maxlength="255" autocomplete="off">
</div> </div>
</h1> </h1>
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}}
<div class="edit-buttons"> <div class="edit-buttons">
<button id="cancel-edit-title" class="ui basic button secondary in-edit" style="display: none">{{.locale.Tr "repo.issues.cancel"}}</button>
<button id="save-edit-title" class="ui primary button in-edit" style="display: none" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.locale.Tr "repo.issues.save"}}</button>
<button id="cancel-edit-title" class="ui basic button secondary in-edit gt-hidden">{{.locale.Tr "repo.issues.cancel"}}</button>
<button id="save-edit-title" class="ui primary button in-edit gt-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.locale.Tr "repo.issues.save"}}</button>
</div> </div>
{{end}} {{end}}
</div> </div>
{{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}}
</span> </span>
{{end}} {{end}}
<span id="pull-desc-edit" style="display: none">
<span id="pull-desc-edit gt-hidden">
<div class="ui floating filter dropdown"> <div class="ui floating filter dropdown">
<div class="ui basic small button"> <div class="ui basic small button">
<span class="text">{{.locale.Tr "repo.pulls.compare_compare"}}: {{$.HeadTarget}}</span> <span class="text">{{.locale.Tr "repo.pulls.compare_compare"}}: {{$.HeadTarget}}</span>

+ 2
- 2
templates/repo/migrate/migrating.tmpl View File

<img src="{{AssetUrlPrefix}}/img/loading.png"/> <img src="{{AssetUrlPrefix}}/img/loading.png"/>
</div> </div>
</div> </div>
<div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column" style="display: none;">
<div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column gt-hidden">
<div> <div>
<img src="{{AssetUrlPrefix}}/img/failed.png"/> <img src="{{AssetUrlPrefix}}/img/failed.png"/>
</div> </div>
<p>{{.locale.Tr "repo.migrate.migrating" .CloneAddr | Safe}}</p> <p>{{.locale.Tr "repo.migrate.migrating" .CloneAddr | Safe}}</p>
<p id="repo_migrating_progress_message"></p> <p id="repo_migrating_progress_message"></p>
</div> </div>
<div id="repo_migrating_failed" hidden>
<div id="repo_migrating_failed" class="gt-hidden">
{{if .CloneAddr}} {{if .CloneAddr}}
<p>{{.locale.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p> <p>{{.locale.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
{{else}} {{else}}

+ 2
- 2
templates/repo/migrate/options.tmpl View File

<input id="lfs" name="lfs" type="checkbox" {{if .lfs}} checked{{end}}> <input id="lfs" name="lfs" type="checkbox" {{if .lfs}} checked{{end}}>
<label>{{.locale.Tr "repo.migrate_options_lfs"}}</label> <label>{{.locale.Tr "repo.migrate_options_lfs"}}</label>
</div> </div>
<span id="lfs_settings" style="display:none">(<a id="lfs_settings_show" href="#">{{.locale.Tr "repo.settings.advanced_settings"}}</a>)</span>
<span id="lfs_settings" class="gt-hidden">(<a id="lfs_settings_show" href="#">{{.locale.Tr "repo.settings.advanced_settings"}}</a>)</span>
</div> </div>
<div id="lfs_endpoint" style="display:none">
<div id="lfs_endpoint" class="gt-hidden">
<span class="help">{{.locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}{{if .ContextUser.CanImportLocal}} {{.locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}</span> <span class="help">{{.locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}{{if .ContextUser.CanImportLocal}} {{.locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}</span>
<div class="inline field {{if .Err_LFSEndpoint}}error{{end}}"> <div class="inline field {{if .Err_LFSEndpoint}}error{{end}}">
<label>{{.locale.Tr "repo.migrate_options_lfs_endpoint.label"}}</label> <label>{{.locale.Tr "repo.migrate_options_lfs_endpoint.label"}}</label>

+ 1
- 1
templates/repo/settings/deploy_keys.tmpl View File

</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="{{if not .HasError}}hide{{end}} gt-mb-4" id="add-deploy-key-panel">
<div class="{{if not .HasError}}gt-hidden{{end}} gt-mb-4" id="add-deploy-key-panel">
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field"> <div class="field">

+ 1
- 1
templates/repo/settings/githook_edit.tmpl View File

</div> </div>
<div class="field"> <div class="field">
<label for="content">{{$.locale.Tr "repo.settings.githook_content"}}</label> <label for="content">{{$.locale.Tr "repo.settings.githook_content"}}</label>
<textarea id="content" name="content" class="hide">{{if .IsActive}}{{.Content}}{{else}}{{.Sample}}{{end}}</textarea>
<textarea id="content" name="content" class="gt-hidden">{{if .IsActive}}{{.Content}}{{else}}{{.Sample}}{{end}}</textarea>
<div class="editor-loading is-loading"></div> <div class="editor-loading is-loading"></div>
</div> </div>
<div class="inline field"> <div class="inline field">

+ 1
- 1
templates/repo/settings/lfs_file.tmpl View File

<a href="{{.LFSFilesLink}}">{{.locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.LFSFile.Oid}}</span> <a href="{{.LFSFilesLink}}">{{.locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.LFSFile.Oid}}</span>
<div class="ui right"> <div class="ui right">
{{if .EscapeStatus.Escaped}} {{if .EscapeStatus.Escaped}}
<a class="ui mini basic button unescape-button" style="display: none;">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button unescape-button gt-hidden">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a> <a class="ui mini basic button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a>
{{end}} {{end}}
<a class="ui primary show-panel button" href="{{.LFSFilesLink}}/find?oid={{.LFSFile.Oid}}&size={{.LFSFile.Size}}">{{$.locale.Tr "repo.settings.lfs_findcommits"}}</a> <a class="ui primary show-panel button" href="{{.LFSFilesLink}}/find?oid={{.LFSFile.Oid}}&size={{.LFSFile.Size}}">{{$.locale.Tr "repo.settings.lfs_findcommits"}}</a>

+ 1
- 1
templates/repo/settings/webhook/history.tmpl View File

</span> </span>
</div> </div>
</div> </div>
<div class="info hide" id="info-{{.ID}}">
<div class="info gt-hidden" id="info-{{.ID}}">
<div class="ui top attached tabular menu"> <div class="ui top attached tabular menu">
<a class="item active" data-tab="request-{{.ID}}">{{$.locale.Tr "repo.settings.webhook.request"}}</a> <a class="item active" data-tab="request-{{.ID}}">{{$.locale.Tr "repo.settings.webhook.request"}}</a>
<a class="item" data-tab="response-{{.ID}}"> <a class="item" data-tab="response-{{.ID}}">

+ 1
- 1
templates/repo/settings/webhook/settings.tmpl View File

</div> </div>
</div> </div>


<div class="events fields ui grid" {{if not .Webhook.ChooseEvents}}style="display:none"{{end}}>
<div class="events fields ui grid {{if not .Webhook.ChooseEvents}}gt-hidden{{end}}">
<!-- Repository Events --> <!-- Repository Events -->
<div class="fourteen wide column"> <div class="fourteen wide column">
<label>{{.locale.Tr "repo.settings.event_header_repository"}}</label> <label>{{.locale.Tr "repo.settings.event_header_repository"}}</label>

+ 1
- 1
templates/repo/sub_menu.tmpl View File

</div> </div>
</div> </div>
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}} {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}}
<div class="ui segment sub-menu language-stats-details" style="display: none">
<div class="ui segment sub-menu language-stats-details gt-hidden">
<div class="ui horizontal center link list"> <div class="ui horizontal center link list">
{{range .LanguageStats}} {{range .LanguageStats}}
<div class="item gt-df gt-ac gt-jc"> <div class="item gt-df gt-ac gt-jc">

+ 2
- 2
templates/repo/view_file.tmpl View File

{{end}} {{end}}
<a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{.locale.Tr "repo.file_history"}}</a> <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{.locale.Tr "repo.file_history"}}</a>
{{if .EscapeStatus.Escaped}} {{if .EscapeStatus.Escaped}}
<a class="ui mini basic button unescape-button" style="display: none;">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button unescape-button gt-hidden">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a> <a class="ui mini basic button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a>
{{end}} {{end}}
</div> </div>
{{end}} {{end}}
{{end}} {{end}}
{{else if .EscapeStatus.Escaped}} {{else if .EscapeStatus.Escaped}}
<a class="ui mini basic button unescape-button gt-mr-2" style="display: none;">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button unescape-button gt-mr-2 gt-hidden">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui mini basic button escape-button gt-mr-2">{{.locale.Tr "repo.escape_control_characters"}}</a> <a class="ui mini basic button escape-button gt-mr-2">{{.locale.Tr "repo.escape_control_characters"}}</a>
{{end}} {{end}}
</div> </div>

+ 1
- 1
templates/repo/view_list.tmpl View File

<span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{RenderCommitMessageLinkSubject $.Context .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}}</span> <span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{RenderCommitMessageLinkSubject $.Context .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}}</span>
{{if IsMultilineCommitMessage .LatestCommit.Message}} {{if IsMultilineCommitMessage .LatestCommit.Message}}
<button class="ui button ellipsis-button" aria-expanded="false">...</button> <button class="ui button ellipsis-button" aria-expanded="false">...</button>
<pre class="commit-body" style="display: none;">{{RenderCommitBody $.Context .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}} {{end}}
</span> </span>
{{end}} {{end}}

+ 1
- 1
templates/repo/wiki/view.tmpl View File

</div> </div>
<div class="eight wide right aligned column"> <div class="eight wide right aligned column">
{{if .EscapeStatus.Escaped}} {{if .EscapeStatus.Escaped}}
<a class="ui small button unescape-button" style="display: none;">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui small button unescape-button gt-hidden">{{.locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui small button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a> <a class="ui small button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a>
{{end}} {{end}}
{{if and .CanWriteWiki (not .Repository.IsMirror)}} {{if and .CanWriteWiki (not .Repository.IsMirror)}}

+ 1
- 1
templates/shared/secrets/add_list.tmpl View File

</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="{{if not .HasError}}hide {{end}}gt-mb-4" id="add-secret-panel">
<div class="{{if not .HasError}}gt-hidden {{end}}gt-mb-4" id="add-secret-panel">
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field"> <div class="field">

+ 9
- 9
templates/user/auth/webauthn_error.tmpl View File

<div class="header"> <div class="header">
{{.locale.Tr "webauthn_error"}} {{.locale.Tr "webauthn_error"}}
</div> </div>
<div class="hide" data-webauthn-error-msg="browser"><p>{{.locale.Tr "webauthn_unsupported_browser"}}</div>
<div class="hide" data-webauthn-error-msg="unknown"><p>{{.locale.Tr "webauthn_error_unknown"}}</div>
<div class="hide" data-webauthn-error-msg="insecure"><p>{{.locale.Tr "webauthn_error_insecure"}}</div>
<div class="hide" data-webauthn-error-msg="unable-to-process"><p>{{.locale.Tr "webauthn_error_unable_to_process"}}</div>
<div class="hide" data-webauthn-error-msg="duplicated"><p>{{.locale.Tr "webauthn_error_duplicated"}}</div>
<div class="hide" data-webauthn-error-msg="empty"><p>{{.locale.Tr "webauthn_error_empty"}}</div>
<div class="hide" data-webauthn-error-msg="timeout"><p>{{.locale.Tr "webauthn_error_timeout"}}</div>
<div class="hide" data-webauthn-error-msg="general"></div>
<div class="gt-hidden" data-webauthn-error-msg="browser"><p>{{.locale.Tr "webauthn_unsupported_browser"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="unknown"><p>{{.locale.Tr "webauthn_error_unknown"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="insecure"><p>{{.locale.Tr "webauthn_error_insecure"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="unable-to-process"><p>{{.locale.Tr "webauthn_error_unable_to_process"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="duplicated"><p>{{.locale.Tr "webauthn_error_duplicated"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="empty"><p>{{.locale.Tr "webauthn_error_empty"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="timeout"><p>{{.locale.Tr "webauthn_error_timeout"}}</div>
<div class="gt-hidden" data-webauthn-error-msg="general"></div>
</div> </div>
</div> </div>
<div class="actions"> <div class="actions">
<button onclick="window.location.reload()" class="success ui button hide webauthn_error_timeout">{{.locale.Tr "webauthn_reload"}}</button>
<button onclick="window.location.reload()" class="success ui button gt-hidden webauthn_error_timeout">{{.locale.Tr "webauthn_reload"}}</button>
<div class="ui cancel button">{{.locale.Tr "cancel"}}</div> <div class="ui cancel button">{{.locale.Tr "cancel"}}</div>
</div> </div>
</div> </div>

+ 1
- 1
templates/user/notification/notification_div.tmpl View File

{{if and (eq .Status 1)}} {{if and (eq .Status 1)}}
<form action="{{AppSubUrl}}/notifications/purge" method="POST" style="margin-left: auto;"> <form action="{{AppSubUrl}}/notifications/purge" method="POST" style="margin-left: auto;">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<div class="{{if not $notificationUnreadCount}}hide{{end}}">
<div class="{{if not $notificationUnreadCount}}gt-hidden{{end}}">
<button class="ui mini button primary" title='{{$.locale.Tr "notification.mark_all_as_read"}}'> <button class="ui mini button primary" title='{{$.locale.Tr "notification.mark_all_as_read"}}'>
{{svg "octicon-checklist"}} {{svg "octicon-checklist"}}
</button> </button>

+ 1
- 1
templates/user/settings/keys_gpg.tmpl View File

</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="{{if not .HasGPGError}}hide{{end}} gt-mb-4" id="add-gpg-key-panel">
<div class="{{if not .HasGPGError}}gt-hidden{{end}} gt-mb-4" id="add-gpg-key-panel">
<form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post"> <form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name="title" value="none"> <input type="hidden" name="title" value="none">

+ 1
- 1
templates/user/settings/keys_principal.tmpl View File

</div> </div>
<br> <br>


<div {{if not .HasPrincipalError}}class="hide"{{end}} id="add-ssh-principal-panel">
<div {{if not .HasPrincipalError}}class="gt-hidden"{{end}} id="add-ssh-principal-panel">
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.locale.Tr "settings.add_new_principal"}} {{.locale.Tr "settings.add_new_principal"}}
</h4> </h4>

+ 1
- 1
templates/user/settings/keys_ssh.tmpl View File

</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<div class="{{if not .HasSSHError}}hide{{end}} gt-mb-4" id="add-ssh-key-panel">
<div class="{{if not .HasSSHError}}gt-hidden{{end}} gt-mb-4" id="add-ssh-key-panel">
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">

+ 2
- 2
templates/user/settings/profile.tmpl View File

{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_Name}}error{{end}}"> <div class="required field {{if .Err_Name}}error{{end}}">
<label for="username">{{.locale.Tr "username"}} <label for="username">{{.locale.Tr "username"}}
<span class="text red hide" id="name-change-prompt"> {{.locale.Tr "settings.change_username_prompt"}}</span>
<span class="text red hide" id="name-change-redirect-prompt"> {{.locale.Tr "settings.change_username_redirect_prompt"}}</span>
<span class="text red gt-hidden" id="name-change-prompt"> {{.locale.Tr "settings.change_username_prompt"}}</span>
<span class="text red gt-hidden" id="name-change-redirect-prompt"> {{.locale.Tr "settings.change_username_redirect_prompt"}}</span>
</label> </label>
<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if or (not .SignedUser.IsLocal) .IsReverseProxy}}disabled{{end}}> <input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if or (not .SignedUser.IsLocal) .IsReverseProxy}}disabled{{end}}>
{{if or (not .SignedUser.IsLocal) .IsReverseProxy}} {{if or (not .SignedUser.IsLocal) .IsReverseProxy}}

+ 3
- 3
web_src/js/components/DiffFileTree.vue View File

}, },
adjustToggleButton(visible) { adjustToggleButton(visible) {
const [toShow, toHide] = document.querySelectorAll('.diff-toggle-file-tree-button .icon'); const [toShow, toHide] = document.querySelectorAll('.diff-toggle-file-tree-button .icon');
toShow.classList.toggle('hide', visible); // hide the toShow icon if the tree is visible
toHide.classList.toggle('hide', !visible); // similarly
toShow.classList.toggle('gt-hidden', visible); // hide the toShow icon if the tree is visible
toHide.classList.toggle('gt-hidden', !visible); // similarly


const diffTree = document.getElementById('diff-file-tree'); const diffTree = document.getElementById('diff-file-tree');
diffTree.classList.toggle('hide', !visible);
diffTree.classList.toggle('gt-hidden', !visible);
}, },
loadMoreData() { loadMoreData() {
this.isLoadingNewData = true; this.isLoadingNewData = true;

+ 23
- 22
web_src/js/features/admin/common.js View File

import $ from 'jquery'; import $ from 'jquery';
import {checkAppUrl} from '../common-global.js'; import {checkAppUrl} from '../common-global.js';
import {hideElem, showElem, toggleElem} from '../../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;


if ($(this).val().substring(0, 1) === '0') { if ($(this).val().substring(0, 1) === '0') {
$('#user_name').removeAttr('disabled'); $('#user_name').removeAttr('disabled');
$('#login_name').removeAttr('required'); $('#login_name').removeAttr('required');
$('.non-local').hide();
$('.local').show();
hideElem($('.non-local'));
showElem($('.local'));
$('#user_name').focus(); $('#user_name').focus();


if ($(this).data('password') === 'required') { if ($(this).data('password') === 'required') {
$('#user_name').attr('disabled', 'disabled'); $('#user_name').attr('disabled', 'disabled');
} }
$('#login_name').attr('required', 'required'); $('#login_name').attr('required', 'required');
$('.non-local').show();
$('.local').hide();
showElem($('.non-local'));
hideElem($('.local'));
$('#login_name').focus(); $('#login_name').focus();


$('#password').removeAttr('required'); $('#password').removeAttr('required');


function onSecurityProtocolChange() { function onSecurityProtocolChange() {
if ($('#security_protocol').val() > 0) { if ($('#security_protocol').val() > 0) {
$('.has-tls').show();
showElem($('.has-tls'));
} else { } else {
$('.has-tls').hide();
hideElem($('.has-tls'));
} }
} }


function onUsePagedSearchChange() { function onUsePagedSearchChange() {
if ($('#use_paged_search').prop('checked')) { if ($('#use_paged_search').prop('checked')) {
$('.search-page-size').show()
showElem($('.search-page-size'))
.find('input').attr('required', 'required'); .find('input').attr('required', 'required');
} else { } else {
$('.search-page-size').hide()
hideElem($('.search-page-size'))
.find('input').removeAttr('required'); .find('input').removeAttr('required');
} }
} }


function onOAuth2Change(applyDefaultValues) { function onOAuth2Change(applyDefaultValues) {
$('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
hideElem($('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url'));
$('.open_id_connect_auto_discovery_url input[required]').removeAttr('required'); $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');


const provider = $('#oauth2_provider').val(); const provider = $('#oauth2_provider').val();
switch (provider) { switch (provider) {
case 'openidConnect': case 'openidConnect':
$('.open_id_connect_auto_discovery_url input').attr('required', 'required'); $('.open_id_connect_auto_discovery_url input').attr('required', 'required');
$('.open_id_connect_auto_discovery_url').show();
showElem($('.open_id_connect_auto_discovery_url'));
break; break;
default: default:
if ($(`#${provider}_customURLSettings`).data('required')) { if ($(`#${provider}_customURLSettings`).data('required')) {
$('#oauth2_use_custom_url').attr('checked', 'checked'); $('#oauth2_use_custom_url').attr('checked', 'checked');
} }
if ($(`#${provider}_customURLSettings`).data('available')) { if ($(`#${provider}_customURLSettings`).data('available')) {
$('.oauth2_use_custom_url').show();
showElem($('.oauth2_use_custom_url'));
} }
} }
onOAuth2UseCustomURLChange(applyDefaultValues); onOAuth2UseCustomURLChange(applyDefaultValues);


function onOAuth2UseCustomURLChange(applyDefaultValues) { function onOAuth2UseCustomURLChange(applyDefaultValues) {
const provider = $('#oauth2_provider').val(); const provider = $('#oauth2_provider').val();
$('.oauth2_use_custom_url_field').hide();
hideElem($('.oauth2_use_custom_url_field'));
$('.oauth2_use_custom_url_field input[required]').removeAttr('required'); $('.oauth2_use_custom_url_field input[required]').removeAttr('required');


if ($('#oauth2_use_custom_url').is(':checked')) { if ($('#oauth2_use_custom_url').is(':checked')) {
} }
if ($(`#${provider}_${custom}`).data('available')) { if ($(`#${provider}_${custom}`).data('available')) {
$(`.oauth2_${custom} input`).attr('required', 'required'); $(`.oauth2_${custom} input`).attr('required', 'required');
$(`.oauth2_${custom}`).show();
showElem($(`.oauth2_${custom}`));
} }
} }
} }
} }


function onEnableLdapGroupsChange() { function onEnableLdapGroupsChange() {
$('#ldap-group-options').toggle($('.js-ldap-group-toggle').is(':checked'));
toggleElem($('#ldap-group-options'), $('.js-ldap-group-toggle').is(':checked'));
} }


// New authentication // New authentication
if ($('.admin.new.authentication').length > 0) { if ($('.admin.new.authentication').length > 0) {
$('#auth_type').on('change', function () { $('#auth_type').on('change', function () {
$('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi').hide();
hideElem($('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi'));


$('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]').removeAttr('required'); $('.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]').removeAttr('required');
$('.binddnrequired').removeClass('required'); $('.binddnrequired').removeClass('required');
const authType = $(this).val(); const authType = $(this).val();
switch (authType) { switch (authType) {
case '2': // LDAP case '2': // LDAP
$('.ldap').show();
showElem($('.ldap'));
$('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required'); $('.binddnrequired input, .ldap div.required:not(.dldap) input').attr('required', 'required');
$('.binddnrequired').addClass('required'); $('.binddnrequired').addClass('required');
break; break;
case '3': // SMTP case '3': // SMTP
$('.smtp').show();
$('.has-tls').show();
showElem($('.smtp'));
showElem($('.has-tls'));
$('.smtp div.required input, .has-tls').attr('required', 'required'); $('.smtp div.required input, .has-tls').attr('required', 'required');
break; break;
case '4': // PAM case '4': // PAM
$('.pam').show();
showElem($('.pam'));
$('.pam input').attr('required', 'required'); $('.pam input').attr('required', 'required');
break; break;
case '5': // LDAP case '5': // LDAP
$('.dldap').show();
showElem($('.dldap'));
$('.dldap div.required:not(.ldap) input').attr('required', 'required'); $('.dldap div.required:not(.ldap) input').attr('required', 'required');
break; break;
case '6': // OAuth2 case '6': // OAuth2
$('.oauth2').show();
showElem($('.oauth2'));
$('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required'); $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
onOAuth2Change(true); onOAuth2Change(true);
break; break;
case '7': // SSPI case '7': // SSPI
$('.sspi').show();
showElem($('.sspi'));
$('.sspi div.required input').attr('required', 'required'); $('.sspi div.required input').attr('required', 'required');
break; break;
} }

+ 5
- 4
web_src/js/features/common-global.js View File

import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js'; import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
import {initTooltip} from '../modules/tippy.js'; import {initTooltip} from '../modules/tippy.js';
import {svg} from '../svg.js'; import {svg} from '../svg.js';
import {hideElem, showElem, toggleElem} from '../utils/dom.js';


const {appUrl, csrfToken} = window.config; const {appUrl, csrfToken} = window.config;


$('.tabable.menu .item').tab(); $('.tabable.menu .item').tab();


$('.toggle.button').on('click', function () { $('.toggle.button').on('click', function () {
$($(this).data('target')).slideToggle(100);
toggleElem($($(this).data('target')));
}); });


// make table <tr> and <td> elements clickable like a link // make table <tr> and <td> elements clickable like a link


export function initGlobalButtons() { export function initGlobalButtons() {
$('.show-panel.button').on('click', function () { $('.show-panel.button').on('click', function () {
$($(this).data('panel')).show();
showElem($(this).data('panel'));
}); });


$('.hide-panel.button').on('click', function (event) { $('.hide-panel.button').on('click', function (event) {
event.preventDefault(); event.preventDefault();
let sel = $(this).attr('data-panel'); let sel = $(this).attr('data-panel');
if (sel) { if (sel) {
$(sel).hide();
hideElem($(sel));
return; return;
} }
sel = $(this).attr('data-panel-closest'); sel = $(this).attr('data-panel-closest');
if (sel) { if (sel) {
$(this).closest(sel).hide();
hideElem($(this).closest(sel));
return; return;
} }
// should never happen, otherwise there is a bug in code // should never happen, otherwise there is a bug in code

+ 3
- 2
web_src/js/features/common-issue.js View File

import $ from 'jquery'; import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js'; import {updateIssuesMeta} from './repo-issue.js';
import {toggleElem} from '../utils/dom.js';


export function initCommonIssue() { export function initCommonIssue() {
const $issueSelectAllWrapper = $('.issue-checkbox-all'); const $issueSelectAllWrapper = $('.issue-checkbox-all');
$issueSelectAll.prop({'checked': false, 'indeterminate': false}); $issueSelectAll.prop({'checked': false, 'indeterminate': false});
} }
// if any issue is selected, show the action panel, otherwise show the filter panel // if any issue is selected, show the action panel, otherwise show the filter panel
$('#issue-filters').toggle(!anyChecked);
$('#issue-actions').toggle(anyChecked);
toggleElem($('#issue-filters'), !anyChecked);
toggleElem($('#issue-actions'), anyChecked);
// there are two panels but only one select-all checkbox, so move the checkbox to the visible panel // there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
$('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper); $('#issue-filters, #issue-actions').filter(':visible').find('.column:first').prepend($issueSelectAllWrapper);
}; };

+ 5
- 4
web_src/js/features/common-organization.js View File

import $ from 'jquery'; import $ from 'jquery';
import {initCompLabelEdit} from './comp/LabelEdit.js'; import {initCompLabelEdit} from './comp/LabelEdit.js';
import {hideElem, showElem} from '../utils/dom.js';


export function initCommonOrganization() { export function initCommonOrganization() {
if ($('.organization').length === 0) { if ($('.organization').length === 0) {
const $prompt = $('#org-name-change-prompt'); const $prompt = $('#org-name-change-prompt');
const $prompt_redirect = $('#org-name-change-redirect-prompt'); const $prompt_redirect = $('#org-name-change-redirect-prompt');
if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) { if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) {
$prompt.show();
$prompt_redirect.show();
showElem($prompt);
showElem($prompt_redirect);
} else { } else {
$prompt.hide();
$prompt_redirect.hide();
hideElem($prompt);
hideElem($prompt_redirect);
} }
}); });
} }

+ 4
- 3
web_src/js/features/comp/WebHookEditor.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem, toggleElem} from '../../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;




$('.events.checkbox input').on('change', function () { $('.events.checkbox input').on('change', function () {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {
$('.events.fields').show();
showElem($('.events.fields'));
} }
}); });
$('.non-events.checkbox input').on('change', function () { $('.non-events.checkbox input').on('change', function () {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {
$('.events.fields').hide();
hideElem($('.events.fields'));
} }
}); });


const updateContentType = function () { const updateContentType = function () {
const visible = $('#http_method').val() === 'POST'; const visible = $('#http_method').val() === 'POST';
$('#content_type').parent().parent()[visible ? 'show' : 'hide']();
toggleElem($('#content_type').parent().parent(), visible);
}; };
updateContentType(); updateContentType();
$('#http_method').on('change', () => { $('#http_method').on('change', () => {

+ 4
- 3
web_src/js/features/imagediff.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem} from '../utils/dom.js';


function getDefaultSvgBoundsIfUndefined(svgXml, src) { function getDefaultSvgBoundsIfUndefined(svgXml, src) {
const DefaultSize = 300; const DefaultSize = 300;
if (bounds) { if (bounds) {
info.$image.attr('width', bounds.width); info.$image.attr('width', bounds.width);
info.$image.attr('height', bounds.height); info.$image.attr('height', bounds.height);
info.$boundsInfo.hide();
hideElem(info.$boundsInfo);
} }
} }
} }
initOverlay(createContext($imageAfter[2], $imageBefore[2])); initOverlay(createContext($imageAfter[2], $imageBefore[2]));
} }


$container.find('> .loader').hide();
$container.find('> .hide').removeClass('hide');
hideElem($container.find('> .loader'));
$container.find('> .gt-hidden').removeClass('gt-hidden');
} }


function initSideBySide(sizes) { function initSideBySide(sizes) {

+ 4
- 3
web_src/js/features/install.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


export function initInstall() { export function initInstall() {
if ($('.page-content.install').length === 0) { if ($('.page-content.install').length === 0) {
// Database type change detection. // Database type change detection.
$('#db_type').on('change', function () { $('#db_type').on('change', function () {
const dbType = $(this).val(); const dbType = $(this).val();
$('div[data-db-setting-for]').hide();
$(`div[data-db-setting-for=${dbType}]`).show();
hideElem($('div[data-db-setting-for]'));
showElem($(`div[data-db-setting-for=${dbType}]`));


if (dbType !== 'sqlite3') { if (dbType !== 'sqlite3') {
// for most remote database servers // for most remote database servers
$(`div[data-db-setting-for=common-host]`).show();
showElem($(`div[data-db-setting-for=common-host]`));
const lastDbHost = $dbHost.val(); const lastDbHost = $dbHost.val();
const isDbHostDefault = !lastDbHost || Object.values(defaultDbHosts).includes(lastDbHost); const isDbHostDefault = !lastDbHost || Object.values(defaultDbHosts).includes(lastDbHost);
if (isDbHostDefault) { if (isDbHostDefault) {

+ 3
- 2
web_src/js/features/org-team.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


const {appSubUrl} = window.config; const {appSubUrl} = window.config;


$('.organization.new.team input[name=permission]').on('change', () => { $('.organization.new.team input[name=permission]').on('change', () => {
const val = $('input[name=permission]:checked', '.organization.new.team').val(); const val = $('input[name=permission]:checked', '.organization.new.team').val();
if (val === 'admin') { if (val === 'admin') {
$('.organization.new.team .team-units').hide();
hideElem($('.organization.new.team .team-units'));
} else { } else {
$('.organization.new.team .team-units').show();
showElem($('.organization.new.team .team-units'));
} }
}); });
} }

+ 2
- 1
web_src/js/features/repo-commit.js View File

import $ from 'jquery'; import $ from 'jquery';
import {createTippy} from '../modules/tippy.js'; import {createTippy} from '../modules/tippy.js';
import {toggleElem} from '../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;


$('.ellipsis-button').on('click', function (e) { $('.ellipsis-button').on('click', function (e) {
e.preventDefault(); e.preventDefault();
const expanded = $(this).attr('aria-expanded') === 'true'; const expanded = $(this).attr('aria-expanded') === 'true';
$(this).parent().find('.commit-body').toggle();
toggleElem($(this).parent().find('.commit-body'));
$(this).attr('aria-expanded', String(!expanded)); $(this).attr('aria-expanded', String(!expanded));
}); });
} }

+ 4
- 3
web_src/js/features/repo-common.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem, toggleElem} from '../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;


$(selector).each(function () { $(selector).each(function () {
const $dropdown = $(this); const $dropdown = $(this);
$dropdown.find('.reference.column').on('click', function () { $dropdown.find('.reference.column').on('click', function () {
$dropdown.find('.scrolling.reference-list-menu').hide();
$($(this).data('target')).show();
hideElem($dropdown.find('.scrolling.reference-list-menu'));
showElem($($(this).data('target')));
return false; return false;
}); });
}); });
if ($('.language-stats').length > 0) { if ($('.language-stats').length > 0) {
$('.language-stats').on('click', (e) => { $('.language-stats').on('click', (e) => {
e.preventDefault(); e.preventDefault();
$('.language-stats-details, .repository-menu').slideToggle();
toggleElem($('.language-stats-details, .repository-menu'));
}); });
} }
} }

+ 4
- 4
web_src/js/features/repo-diff.js View File

$this.addClass('active'); $this.addClass('active');


const $target = $($this.data('toggle-selector')); const $target = $($this.data('toggle-selector'));
$target.parent().children().addClass('hide');
$target.removeClass('hide');
$target.parent().children().addClass('gt-hidden');
$target.removeClass('gt-hidden');
}); });
} }


// Previous/Next code review conversation // Previous/Next code review conversation
$(document).on('click', '.previous-conversation', (e) => { $(document).on('click', '.previous-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud'); const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
const $conversations = $('.comment-code-cloud:not(.hide)');
const $conversations = $('.comment-code-cloud:not(.gt-hidden)');
const index = $conversations.index($conversation); const index = $conversations.index($conversation);
const previousIndex = index > 0 ? index - 1 : $conversations.length - 1; const previousIndex = index > 0 ? index - 1 : $conversations.length - 1;
const $previousConversation = $conversations.eq(previousIndex); const $previousConversation = $conversations.eq(previousIndex);
}); });
$(document).on('click', '.next-conversation', (e) => { $(document).on('click', '.next-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud'); const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
const $conversations = $('.comment-code-cloud:not(.hide)');
const $conversations = $('.comment-code-cloud:not(.gt-hidden)');
const index = $conversations.index($conversation); const index = $conversations.index($conversation);
const nextIndex = index < $conversations.length - 1 ? index + 1 : 0; const nextIndex = index < $conversations.length - 1 ? index + 1 : 0;
const $nextConversation = $conversations.eq(nextIndex); const $nextConversation = $conversations.eq(nextIndex);

+ 3
- 2
web_src/js/features/repo-editor.js View File

import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
import {initMarkupContent} from '../markup/content.js'; import {initMarkupContent} from '../markup/content.js';
import {createCodeEditor} from './codeeditor.js'; import {createCodeEditor} from './codeeditor.js';
import {hideElem, showElem} from '../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;
let previewFileModes; let previewFileModes;


$('.js-quick-pull-choice-option').on('change', function () { $('.js-quick-pull-choice-option').on('change', function () {
if ($(this).val() === 'commit-to-new-branch') { if ($(this).val() === 'commit-to-new-branch') {
$('.quick-pull-branch-name').show();
showElem($('.quick-pull-branch-name'));
$('.quick-pull-branch-name input').prop('required', true); $('.quick-pull-branch-name input').prop('required', true);
} else { } else {
$('.quick-pull-branch-name').hide();
hideElem($('.quick-pull-branch-name'));
$('.quick-pull-branch-name input').prop('required', false); $('.quick-pull-branch-name input').prop('required', false);
} }
$('#commit-button').text($(this).attr('button_text')); $('#commit-button').text($(this).attr('button_text'));

+ 2
- 1
web_src/js/features/repo-findfile.js View File

import $ from 'jquery'; import $ from 'jquery';
import {svg} from '../svg.js'; import {svg} from '../svg.js';
import {toggleElem} from '../utils/dom.js';


const {csrf} = window.config; const {csrf} = window.config;


const filterResult = filterRepoFilesWeighted(files, filter); const filterResult = filterRepoFilesWeighted(files, filter);
const tmplRow = `<tr><td><a></a></td></tr>`; const tmplRow = `<tr><td><a></a></td></tr>`;


$repoFindFileNoResult.toggle(filterResult.length === 0);
toggleElem($repoFindFileNoResult, filterResult.length === 0);
for (const r of filterResult) { for (const r of filterResult) {
const $row = $(tmplRow); const $row = $(tmplRow);
const $a = $row.find('a'); const $a = $row.find('a');

+ 6
- 6
web_src/js/features/repo-graph.js View File

ajaxUrl.searchParams.set('div-only', 'true'); ajaxUrl.searchParams.set('div-only', 'true');
window.history.replaceState({}, '', queryString ? `?${queryString}` : window.location.pathname); window.history.replaceState({}, '', queryString ? `?${queryString}` : window.location.pathname);
$('#pagination').empty(); $('#pagination').empty();
$('#rel-container').addClass('hide');
$('#rev-container').addClass('hide');
$('#loading-indicator').removeClass('hide');
$('#rel-container').addClass('gt-hidden');
$('#rev-container').addClass('gt-hidden');
$('#loading-indicator').removeClass('gt-hidden');
(async () => { (async () => {
const div = $(await $.ajax(String(ajaxUrl))); const div = $(await $.ajax(String(ajaxUrl)));
$('#pagination').html(div.find('#pagination').html()); $('#pagination').html(div.find('#pagination').html());
$('#rel-container').html(div.find('#rel-container').html()); $('#rel-container').html(div.find('#rel-container').html());
$('#rev-container').html(div.find('#rev-container').html()); $('#rev-container').html(div.find('#rev-container').html());
$('#loading-indicator').addClass('hide');
$('#rel-container').removeClass('hide');
$('#rev-container').removeClass('hide');
$('#loading-indicator').addClass('gt-hidden');
$('#rel-container').removeClass('gt-hidden');
$('#rev-container').removeClass('gt-hidden');
})(); })();
}; };
const dropdownSelected = params.getAll('branch'); const dropdownSelected = params.getAll('branch');

+ 6
- 5
web_src/js/features/repo-home.js View File

import $ from 'jquery'; import $ from 'jquery';
import {stripTags} from '../utils.js'; import {stripTags} from '../utils.js';
import {hideElem, showElem} from '../utils/dom.js';


const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;


const topicPrompts = getPrompts(); const topicPrompts = getPrompts();


mgrBtn.on('click', () => { mgrBtn.on('click', () => {
viewDiv.hide();
editDiv.css('display', ''); // show Semantic UI Grid
hideElem(viewDiv);
showElem(editDiv);
}); });


function getPrompts() { function getPrompts() {
const hidePrompt = $('div.hide#validate_prompt');
const hidePrompt = $('#validate_prompt');
const prompts = { const prompts = {
countPrompt: hidePrompt.children('#count_prompt').text(), countPrompt: hidePrompt.children('#count_prompt').text(),
formatPrompt: hidePrompt.children('#format_prompt').text() formatPrompt: hidePrompt.children('#format_prompt').text()
link.insertBefore(last); link.insertBefore(last);
} }
} }
editDiv.css('display', 'none');
viewDiv.show();
hideElem(editDiv);
showElem(viewDiv);
} }
}).fail((xhr) => { }).fail((xhr) => {
if (xhr.status === 422) { if (xhr.status === 422) {

+ 2
- 2
web_src/js/features/repo-issue-content.js View File

${svg('octicon-x', 16, 'close icon inside')} ${svg('octicon-x', 16, 'close icon inside')}
<div class="header gt-df gt-ac gt-sb"> <div class="header gt-df gt-ac gt-sb">
<div>${itemTitleHtml}</div> <div>${itemTitleHtml}</div>
<div class="ui dropdown dialog-header-options gt-df gt-ac gt-mr-5 hide">
<div class="ui dropdown dialog-header-options gt-df gt-ac gt-mr-5 gt-hidden">
${i18nTextOptions}${svg('octicon-triangle-down', 14, 'dropdown icon')} ${i18nTextOptions}${svg('octicon-triangle-down', 14, 'dropdown icon')}
<div class="menu"> <div class="menu">
<div class="item red text" data-option-item="delete">${i18nTextDeleteFromHistory}</div> <div class="item red text" data-option-item="delete">${i18nTextDeleteFromHistory}</div>
$dialog.find('.comment-diff-data').removeClass('is-loading').html(resp.diffHtml); $dialog.find('.comment-diff-data').removeClass('is-loading').html(resp.diffHtml);
// there is only one option "item[data-option-item=delete]", so the dropdown can be entirely shown/hidden. // there is only one option "item[data-option-item=delete]", so the dropdown can be entirely shown/hidden.
if (resp.canSoftDelete) { if (resp.canSoftDelete) {
$dialog.find('.dialog-header-options').removeClass('hide');
$dialog.find('.dialog-header-options').removeClass('gt-hidden');
} }
}); });
}, },

+ 18
- 17
web_src/js/features/repo-issue.js View File

import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initTooltip, showTemporaryTooltip} from '../modules/tippy.js'; import {initTooltip, showTemporaryTooltip} from '../modules/tippy.js';
import {hideElem, showElem, toggleElem} from '../utils/dom.js';


const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;


} }


function updateDeadline(deadlineString) { function updateDeadline(deadlineString) {
$('#deadline-err-invalid-date').hide();
hideElem($('#deadline-err-invalid-date'));
$('#deadline-loader').addClass('loading'); $('#deadline-loader').addClass('loading');


let realDeadline = null; let realDeadline = null;


if (Number.isNaN(newDate)) { if (Number.isNaN(newDate)) {
$('#deadline-loader').removeClass('loading'); $('#deadline-loader').removeClass('loading');
$('#deadline-err-invalid-date').show();
showElem($('#deadline-err-invalid-date'));
return false; return false;
} }
realDeadline = new Date(newDate); realDeadline = new Date(newDate);
}, },
error() { error() {
$('#deadline-loader').removeClass('loading'); $('#deadline-loader').removeClass('loading');
$('#deadline-err-invalid-date').show();
showElem($('#deadline-err-invalid-date'));
}, },
}); });
} }
$(document).on('click', '.cancel-code-comment', (e) => { $(document).on('click', '.cancel-code-comment', (e) => {
const form = $(e.currentTarget).closest('form'); const form = $(e.currentTarget).closest('form');
if (form.length > 0 && form.hasClass('comment-form')) { if (form.length > 0 && form.hasClass('comment-form')) {
form.addClass('hide');
form.closest('.comment-code-cloud').find('button.comment-form-reply').show();
form.addClass('gt-hidden');
showElem(form.closest('.comment-code-cloud').find('button.comment-form-reply'));
} else { } else {
form.closest('.comment-code-cloud').remove(); form.closest('.comment-code-cloud').remove();
} }


export function initRepoPullRequestMergeInstruction() { export function initRepoPullRequestMergeInstruction() {
$('.show-instruction').on('click', () => { $('.show-instruction').on('click', () => {
$('.instruct-content').toggle();
toggleElem($('.instruct-content'));
}); });
} }


$(document).on('click', 'button.comment-form-reply', async function (e) { $(document).on('click', 'button.comment-form-reply', async function (e) {
e.preventDefault(); e.preventDefault();


$(this).hide();
hideElem($(this));
const form = $(this).closest('.comment-code-cloud').find('.comment-form'); const form = $(this).closest('.comment-code-cloud').find('.comment-form');
form.removeClass('hide');
form.removeClass('gt-hidden');
const $textarea = form.find('textarea'); const $textarea = form.find('textarea');
let easyMDE = getAttachedEasyMDE($textarea); let easyMDE = getAttachedEasyMDE($textarea);
if (!easyMDE) { if (!easyMDE) {


$('.btn-review').on('click', function (e) { $('.btn-review').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$(this).closest('.dropdown').find('.menu').toggle('visible');
$(this).closest('.dropdown').find('.menu').toggle('visible'); // eslint-disable-line
}).closest('.dropdown').find('.close').on('click', function (e) { }).closest('.dropdown').find('.close').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$(this).closest('.menu').toggle('visible');
$(this).closest('.menu').toggle('visible'); // eslint-disable-line
}); });


$(document).on('click', 'a.add-code-comment', async function (e) { $(document).on('click', 'a.add-code-comment', async function (e) {
// Reference issue // Reference issue
$(document).on('click', '.reference-issue', function (event) { $(document).on('click', '.reference-issue', function (event) {
const $this = $(this); const $this = $(this);
$this.closest('.dropdown').find('.menu').toggle('visible');
$this.closest('.dropdown').find('.menu').toggle('visible'); // eslint-disable-line


const content = $(`#${$this.data('target')}`).text(); const content = $(`#${$this.data('target')}`).text();
const poster = $this.data('poster-username'); const poster = $this.data('poster-username');
const $editInput = $('#edit-title-input input'); const $editInput = $('#edit-title-input input');


const editTitleToggle = function () { const editTitleToggle = function () {
$issueTitle.toggle();
$('.not-in-edit').toggle();
$('#edit-title-input').toggle();
$('#pull-desc').toggle();
$('#pull-desc-edit').toggle();
$('.in-edit').toggle();
toggleElem($issueTitle);
toggleElem($('.not-in-edit'));
toggleElem($('#edit-title-input'));
toggleElem($('#pull-desc'));
toggleElem($('#pull-desc-edit'));
toggleElem($('.in-edit'));
$('#issue-title-wrapper').toggleClass('edit-active'); $('#issue-title-wrapper').toggleClass('edit-active');
$editInput.focus(); $editInput.focus();
return false; return false;

+ 21
- 20
web_src/js/features/repo-legacy.js View File

import {initCompReactionSelector} from './comp/ReactionSelector.js'; import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoSettingBranches} from './repo-settings.js'; import {initRepoSettingBranches} from './repo-settings.js';
import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js'; import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js';
import {hideElem, showElem} from '../utils/dom.js';


const {csrfToken} = window.config; const {csrfToken} = window.config;


} }
}); });
$selectBranch.find('.reference.column').on('click', function () { $selectBranch.find('.reference.column').on('click', function () {
$selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
hideElem($selectBranch.find('.scrolling.reference-list-menu'));
$selectBranch.find('.reference .text').removeClass('black'); $selectBranch.find('.reference .text').removeClass('black');
$($(this).data('target')).css('display', 'block');
showElem($($(this).data('target')));
$(this).find('.text').addClass('black'); $(this).find('.text').addClass('black');
return false; return false;
}); });
$(this).parent().find('.item').each(function () { $(this).parent().find('.item').each(function () {
if ($(this).hasClass('checked')) { if ($(this).hasClass('checked')) {
listIds.push($(this).data('id')); listIds.push($(this).data('id'));
$($(this).data('id-selector')).removeClass('hide');
$($(this).data('id-selector')).removeClass('gt-hidden');
} else { } else {
$($(this).data('id-selector')).addClass('hide');
$($(this).data('id-selector')).addClass('gt-hidden');
} }
}); });
if (listIds.length === 0) { if (listIds.length === 0) {
$noSelect.removeClass('hide');
$noSelect.removeClass('gt-hidden');
} else { } else {
$noSelect.addClass('hide');
$noSelect.addClass('gt-hidden');
} }
$($(this).parent().data('id')).val(listIds.join(',')); $($(this).parent().data('id')).val(listIds.join(','));
return false; return false;
} }


$list.find('.item').each(function () { $list.find('.item').each(function () {
$(this).addClass('hide');
$(this).addClass('gt-hidden');
}); });
$noSelect.removeClass('hide');
$noSelect.removeClass('gt-hidden');
$($(this).parent().data('id')).val(''); $($(this).parent().data('id')).val('');
}); });
} }
</a> </a>
`); `);


$(`.ui${select_id}.list .no-select`).addClass('hide');
$(`.ui${select_id}.list .no-select`).addClass('gt-hidden');
$(input_id).val($(this).data('id')); $(input_id).val($(this).data('id'));
}); });
$menu.find('.no-select.item').on('click', function () { $menu.find('.no-select.item').on('click', function () {
} }


$list.find('.selected').html(''); $list.find('.selected').html('');
$list.find('.no-select').removeClass('hide');
$list.find('.no-select').removeClass('gt-hidden');
$(input_id).val(''); $(input_id).val('');
}); });
} }
async function onEditContent(event) { async function onEditContent(event) {
event.preventDefault(); event.preventDefault();


$(this).closest('.dropdown').find('.menu').toggle('visible');
$(this).closest('.dropdown').find('.menu').toggle('visible'); // eslint-disable-line
const $segment = $(this).closest('.header').next(); const $segment = $(this).closest('.header').next();
const $editContentZone = $segment.find('.edit-content-zone'); const $editContentZone = $segment.find('.edit-content-zone');
const $renderContent = $segment.find('.render-content'); const $renderContent = $segment.find('.render-content');
}); });


$editContentZone.find('.cancel.button').on('click', () => { $editContentZone.find('.cancel.button').on('click', () => {
$renderContent.show();
$editContentZone.hide();
showElem($renderContent);
hideElem($editContentZone);
if (dz) { if (dz) {
dz.emit('reload'); dz.emit('reload');
} }
}); });


$saveButton.on('click', () => { $saveButton.on('click', () => {
$renderContent.show();
$editContentZone.hide();
showElem($renderContent);
hideElem($editContentZone);
const $attachments = $dropzone.find('.files').find('[name=files]').map(function () { const $attachments = $dropzone.find('.files').find('[name=files]').map(function () {
return $(this).val(); return $(this).val();
}).get(); }).get();
} }


// Show write/preview tab and copy raw content as needed // Show write/preview tab and copy raw content as needed
$editContentZone.show();
$renderContent.hide();
showElem($editContentZone);
hideElem($renderContent);
if ($textarea.val().length === 0) { if ($textarea.val().length === 0) {
$textarea.val($rawContent.text()); $textarea.val($rawContent.text());
easyMDE.value($rawContent.text()); easyMDE.value($rawContent.text());
// show pull request form // show pull request form
$repoComparePull.find('button.show-form').on('click', function (e) { $repoComparePull.find('button.show-form').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$(this).parent().hide();
hideElem($(this).parent());


const $form = $repoComparePull.find('.pullrequest-form'); const $form = $repoComparePull.find('.pullrequest-form');
$form.show();
showElem($form);
$form.find('textarea.edit_area').each(function() { $form.find('textarea.edit_area').each(function() {
const easyMDE = getAttachedEasyMDE($(this)); const easyMDE = getAttachedEasyMDE($(this));
if (easyMDE) { if (easyMDE) {


// Quote reply // Quote reply
$(document).on('click', '.quote-reply', function (event) { $(document).on('click', '.quote-reply', function (event) {
$(this).closest('.dropdown').find('.menu').toggle('visible');
$(this).closest('.dropdown').find('.menu').toggle('visible'); // eslint-disable-line
const target = $(this).data('target'); const target = $(this).data('target');
const quote = $(`#${target}`).text().replace(/\n/g, '\n> '); const quote = $(`#${target}`).text().replace(/\n/g, '\n> ');
const content = `> ${quote}\n\n`; const content = `> ${quote}\n\n`;

+ 13
- 12
web_src/js/features/repo-migrate.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;


export function initRepoMigrationStatusChecker() { export function initRepoMigrationStatusChecker() {
const migrating = $('#repo_migrating'); const migrating = $('#repo_migrating');
$('#repo_migrating_failed').hide();
$('#repo_migrating_failed_image').hide();
$('#repo_migrating_progress_message').hide();
hideElem($('#repo_migrating_failed'));
hideElem($('#repo_migrating_failed_image'));
hideElem($('#repo_migrating_progress_message'));
if (migrating) { if (migrating) {
const task = migrating.attr('task'); const task = migrating.attr('task');
if (task === undefined) { if (task === undefined) {
window.location.reload(); window.location.reload();
return; return;
} else if (xhr.responseJSON.status === 3) { } else if (xhr.responseJSON.status === 3) {
$('#repo_migrating_progress').hide();
$('#repo_migrating').hide();
$('#repo_migrating_failed').show();
$('#repo_migrating_failed_image').show();
hideElem($('#repo_migrating_progress'));
hideElem($('#repo_migrating'));
showElem($('#repo_migrating_failed'));
showElem($('#repo_migrating_failed_image'));
$('#repo_migrating_failed_error').text(xhr.responseJSON.message); $('#repo_migrating_failed_error').text(xhr.responseJSON.message);
return; return;
} }
if (xhr.responseJSON.message) { if (xhr.responseJSON.message) {
$('#repo_migrating_progress_message').show();
showElem($('#repo_migrating_progress_message'));
$('#repo_migrating_progress_message').text(xhr.responseJSON.message); $('#repo_migrating_progress_message').text(xhr.responseJSON.message);
} }
setTimeout(() => { setTimeout(() => {
}, 2000); }, 2000);
return; return;
} }
$('#repo_migrating_progress').hide();
$('#repo_migrating').hide();
$('#repo_migrating_failed').show();
$('#repo_migrating_failed_image').show();
hideElem($('#repo_migrating_progress'));
hideElem($('#repo_migrating'));
showElem($('#repo_migrating_failed'));
showElem($('#repo_migrating_failed_image'));
} }
}); });
} }

+ 4
- 3
web_src/js/features/repo-migration.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem, toggleElem} from '../utils/dom.js';


const $service = $('#service_type'); const $service = $('#service_type');
const $user = $('#auth_username'); const $user = $('#auth_username');
$pass.on('keyup', () => {checkItems(false)}); $pass.on('keyup', () => {checkItems(false)});
$token.on('keyup', () => {checkItems(true)}); $token.on('keyup', () => {checkItems(true)});
$mirror.on('change', () => {checkItems(true)}); $mirror.on('change', () => {checkItems(true)});
$('#lfs_settings_show').on('click', () => { $lfsEndpoint.show(); return false });
$('#lfs_settings_show').on('click', () => { showElem($lfsEndpoint); return false });
$lfs.on('change', setLFSSettingsVisibility); $lfs.on('change', setLFSSettingsVisibility);


const $cloneAddr = $('#clone_addr'); const $cloneAddr = $('#clone_addr');


function setLFSSettingsVisibility() { function setLFSSettingsVisibility() {
const visible = $lfs.is(':checked'); const visible = $lfs.is(':checked');
$lfsSettings.toggle(visible);
$lfsEndpoint.hide();
toggleElem($lfsSettings, visible);
hideElem($lfsEndpoint);
} }

+ 2
- 1
web_src/js/features/repo-release.js View File

import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
import {createCommentEasyMDE} from './comp/EasyMDE.js'; import {createCommentEasyMDE} from './comp/EasyMDE.js';
import {hideElem} from '../utils/dom.js';


export function initRepoRelease() { export function initRepoRelease() {
$(document).on('click', '.remove-rel-attach', function() { $(document).on('click', '.remove-rel-attach', function() {
const uuid = $(this).data('uuid'); const uuid = $(this).data('uuid');
const id = $(this).data('id'); const id = $(this).data('id');
$(`input[name='attachment-del-${uuid}']`).attr('value', true); $(`input[name='attachment-del-${uuid}']`).attr('value', true);
$(`#attachment-${id}`).hide();
hideElem($(`#attachment-${id}`));
}); });
} }



+ 5
- 4
web_src/js/features/repo-template.js View File

import $ from 'jquery'; import $ from 'jquery';
import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
import {hideElem, showElem} from '../utils/dom.js';


const {appSubUrl} = window.config; const {appSubUrl} = window.config;


const $templateUnits = $('#template_units'); const $templateUnits = $('#template_units');
const $nonTemplate = $('#non_template'); const $nonTemplate = $('#non_template');
if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') { if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') {
$templateUnits.show();
$nonTemplate.hide();
showElem($templateUnits);
hideElem($nonTemplate);
} else { } else {
$templateUnits.hide();
$nonTemplate.show();
hideElem($templateUnits);
showElem($nonTemplate);
} }
}; };
$repoTemplate.on('change', checkTemplate); $repoTemplate.on('change', checkTemplate);

+ 9
- 8
web_src/js/features/repo-unicode-escape.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


export function initUnicodeEscapeButton() { export function initUnicodeEscapeButton() {
$(document).on('click', 'a.escape-button', (e) => { $(document).on('click', 'a.escape-button', (e) => {
e.preventDefault(); e.preventDefault();
$(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').addClass('unicode-escaped'); $(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').addClass('unicode-escaped');
$(e.target).hide();
$(e.target).siblings('a.unescape-button').show();
hideElem($(e.target));
showElem($(e.target).siblings('a.unescape-button'));
}); });
$(document).on('click', 'a.unescape-button', (e) => { $(document).on('click', 'a.unescape-button', (e) => {
e.preventDefault(); e.preventDefault();
$(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').removeClass('unicode-escaped'); $(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').removeClass('unicode-escaped');
$(e.target).hide();
$(e.target).siblings('a.escape-button').show();
hideElem($(e.target));
showElem($(e.target).siblings('a.escape-button'));
}); });
$(document).on('click', 'a.toggle-escape-button', (e) => { $(document).on('click', 'a.toggle-escape-button', (e) => {
e.preventDefault(); e.preventDefault();
const fileView = fileContent.find('.file-code, .file-view'); const fileView = fileContent.find('.file-code, .file-view');
if (fileView.hasClass('unicode-escaped')) { if (fileView.hasClass('unicode-escaped')) {
fileView.removeClass('unicode-escaped'); fileView.removeClass('unicode-escaped');
fileContent.find('a.unescape-button').hide();
fileContent.find('a.escape-button').show();
hideElem(fileContent.find('a.unescape-button'));
showElem(fileContent.find('a.escape-button'));
} else { } else {
fileView.addClass('unicode-escaped'); fileView.addClass('unicode-escaped');
fileContent.find('a.unescape-button').show();
fileContent.find('a.escape-button').hide();
showElem(fileContent.find('a.unescape-button'));
hideElem(fileContent.find('a.escape-button'));
} }
}); });
} }

+ 7
- 4
web_src/js/features/user-auth-webauthn.js View File

import $ from 'jquery'; import $ from 'jquery';
import {encode, decode} from 'uint8-to-base64'; import {encode, decode} from 'uint8-to-base64';
import {hideElem, showElem} from '../utils/dom.js';


const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;


} }


function webAuthnError(errorType, message) { function webAuthnError(errorType, message) {
$('#webauthn-error [data-webauthn-error-msg]').hide();
hideElem($('#webauthn-error [data-webauthn-error-msg]'));
const $errorGeneral = $(`#webauthn-error [data-webauthn-error-msg=general]`); const $errorGeneral = $(`#webauthn-error [data-webauthn-error-msg=general]`);
if (errorType === 'general') { if (errorType === 'general') {
$errorGeneral.show().text(message || 'unknown error');
showElem($errorGeneral);
$errorGeneral.text(message || 'unknown error');
} else { } else {
const $errorTyped = $(`#webauthn-error [data-webauthn-error-msg=${errorType}]`); const $errorTyped = $(`#webauthn-error [data-webauthn-error-msg=${errorType}]`);
if ($errorTyped.length) { if ($errorTyped.length) {
$errorTyped.show();
showElem($errorTyped);
} else { } else {
$errorGeneral.show().text(`unknown error type: ${errorType}`);
showElem($errorGeneral);
$errorGeneral.text(`unknown error type: ${errorType}`);
} }
} }
$('#webauthn-error').modal('show'); $('#webauthn-error').modal('show');

+ 3
- 2
web_src/js/features/user-auth.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


export function initUserAuthOauth2() { export function initUserAuthOauth2() {
const $oauth2LoginNav = $('#oauth2-login-navigator'); const $oauth2LoginNav = $('#oauth2-login-navigator');
const oauthLoader = $('#oauth2-login-loader'); const oauthLoader = $('#oauth2-login-loader');
const oauthNav = $('#oauth2-login-navigator'); const oauthNav = $('#oauth2-login-navigator');


oauthNav.hide();
hideElem(oauthNav);
oauthLoader.removeClass('disabled'); oauthLoader.removeClass('disabled');


setTimeout(() => { setTimeout(() => {
// recover previous content to let user try again // recover previous content to let user try again
// usually redirection will be performed before this action // usually redirection will be performed before this action
oauthLoader.addClass('disabled'); oauthLoader.addClass('disabled');
oauthNav.show();
showElem(oauthNav);
}, 5000); }, 5000);
}); });
} }

+ 5
- 4
web_src/js/features/user-settings.js View File

import $ from 'jquery'; import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';


export function initUserSettings() { export function initUserSettings() {
if ($('.user.settings.profile').length > 0) { if ($('.user.settings.profile').length > 0) {
const $prompt = $('#name-change-prompt'); const $prompt = $('#name-change-prompt');
const $prompt_redirect = $('#name-change-redirect-prompt'); const $prompt_redirect = $('#name-change-redirect-prompt');
if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) { if ($(this).val().toString().toLowerCase() !== $(this).data('name').toString().toLowerCase()) {
$prompt.show();
$prompt_redirect.show();
showElem($prompt);
showElem($prompt_redirect);
} else { } else {
$prompt.hide();
$prompt_redirect.hide();
hideElem($prompt);
hideElem($prompt_redirect);
} }
}); });
} }

+ 65
- 0
web_src/js/utils/dom.js View File

function getComputedStyleProperty(el, prop) {
const cs = el ? window.getComputedStyle(el) : null;
return cs ? cs[prop] : null;
}

function isShown(el) {
return getComputedStyleProperty(el, 'display') !== 'none';
}

function assertShown(el, expectShown) {
if (window.config.runModeIsProd) return;

// to help developers to catch display bugs, this assertion can be removed after next release cycle or if it has been proved that there is no bug.
if (expectShown && !isShown(el)) {
throw new Error('element is hidden but should be shown');
} else if (!expectShown && isShown(el)) {
throw new Error('element is shown but should be hidden');
}
}

function elementsCall(el, func, ...args) {
if (el instanceof String) {
el = document.querySelectorAll(el);
}
if (el instanceof Node) {
func(el, ...args);
} else if (el.length !== undefined) {
// this works for: NodeList, HTMLCollection, Array, jQuery
for (const e of el) {
func(e, ...args);
}
} else {
throw new Error('invalid argument to be shown/hidden');
}
}

function toggleShown(el, force) {
if (force === true) {
el.classList.remove('gt-hidden');
assertShown(el, true);
} else if (force === false) {
el.classList.add('gt-hidden');
assertShown(el, false);
} else if (force === undefined) {
const wasShown = window.config.runModeIsProd ? undefined : isShown(el);
el.classList.toggle('gt-hidden');
if (wasShown !== undefined) {
assertShown(el, !wasShown);
}
} else {
throw new Error('invalid force argument');
}
}

export function showElem(el) {
elementsCall(el, toggleShown, true);
}

export function hideElem(el) {
elementsCall(el, toggleShown, false);
}

export function toggleElem(el, force) {
elementsCall(el, toggleShown, force);
}

+ 0
- 5
web_src/less/_base.less View File

} }
} }


// TODO: refactor to use ".gt-hidden" instead (a simple search&replace should do the trick)
.hide {
display: none;
}

.center:not(.popup) { .center:not(.popup) {
text-align: center; text-align: center;
} }

+ 0
- 12
web_src/less/_repository.less View File

margin-right: 8.75px; margin-right: 8.75px;
} }


.hide {
display: none !important;
}

.dependency { .dependency {
padding: 0; padding: 0;
white-space: nowrap; white-space: nowrap;
} }
} }


#issue-filters.hide {
display: none;
}

#issue-actions { #issue-actions {
margin-top: -1rem !important; // counteract padding from Semantic margin-top: -1rem !important; // counteract padding from Semantic
} }


#issue-actions.hide {
display: none;
}

.ui.menu .item > img:not(.ui) { .ui.menu .item > img:not(.ui) {
width: auto; width: auto;
} }

+ 11
- 1
web_src/less/helpers.less View File

.gt-js-small { justify-content: flex-start !important; } .gt-js-small { justify-content: flex-start !important; }
} }


// gt-hidden must be placed after all other "display: xxx !important" classes to win the hidden chance
/*
gt-hidden must be placed after all other "display: xxx !important" classes to win the chance
do not use:
* "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex"
* ".hidden" class: it has been polluted by Fomantic UI in many cases
* inline style="display: none": it's difficult to tweak
* jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important"
only use:
* this ".gt-hidden" class
* showElem/hideElem/toggleElem functions in "utils/dom.js"
*/
.gt-hidden { display: none !important; } .gt-hidden { display: none !important; }

Loading…
Cancel
Save