diff options
author | hazycora <hazysu@riseup.net> | 2024-02-26 20:43:04 +0100 |
---|---|---|
committer | hazycora <hazysu@riseup.net> | 2024-04-03 22:16:40 +0200 |
commit | 454ceb2ada2678ecadd0bb6641e19cc6d05edcea (patch) | |
tree | 6fd8992e9e5e7f404bbe46b2538f0a50d0ee33a9 /web_src/js/features | |
parent | Add back ID field to pronouns migration (diff) | |
download | forgejo-454ceb2ada2678ecadd0bb6641e19cc6d05edcea.tar.xz forgejo-454ceb2ada2678ecadd0bb6641e19cc6d05edcea.zip |
add some comments
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/user-settings.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/web_src/js/features/user-settings.js b/web_src/js/features/user-settings.js index 8f68b03b29..111bfc4465 100644 --- a/web_src/js/features/user-settings.js +++ b/web_src/js/features/user-settings.js @@ -4,6 +4,7 @@ function onPronounsDropdownUpdate() { const pronounsCustom = document.getElementById('pronouns-custom'); const pronounsDropdown = document.getElementById('pronouns-dropdown'); const pronounsInput = pronounsDropdown.querySelector('input'); + // must be kept in sync with `routers/web/user/setting/profile.go` const isCustom = !( pronounsInput.value === '' || pronounsInput.value === 'he/him' || @@ -49,8 +50,12 @@ export function initUserSettings() { const pronounsDropdown = document.getElementById('pronouns-dropdown'); const pronounsCustom = document.getElementById('pronouns-custom'); const pronounsInput = pronounsDropdown.querySelector('input'); + + // If JS is disabled, the page will show the custom input, as the dropdown requires JS to work. + // JS progressively enhances the input by adding a dropdown, but it works regardless. pronounsCustom.removeAttribute('name'); pronounsDropdown.style.display = ''; + onPronounsDropdownUpdate(); pronounsInput.addEventListener('change', onPronounsDropdownUpdate); pronounsCustom.addEventListener('input', onPronounsCustomUpdate); |