mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 20:07:03 +01:00
add some comments
This commit is contained in:
parent
8cbacf850a
commit
454ceb2ada
2 changed files with 6 additions and 0 deletions
|
@ -41,6 +41,7 @@ const (
|
|||
tplSettingsRepositories base.TplName = "user/settings/repos"
|
||||
)
|
||||
|
||||
// must be kept in sync with `web_src/js/features/user-settings.js`
|
||||
var recognisedPronouns = []string{"", "he/him", "she/her", "they/them", "it/its", "any pronouns"}
|
||||
|
||||
// Profile render user's profile page
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue