1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-21 08:31:27 -05:00

add some comments

This commit is contained in:
hazycora 2024-02-26 13:43:04 -06:00
parent 8cbacf850a
commit 454ceb2ada
No known key found for this signature in database
GPG key ID: 215AF1F81F86940E
2 changed files with 6 additions and 0 deletions

View file

@ -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

View file

@ -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);