Add "Unspecified" option to pronouns dropdown
This commit is contained in:
parent
994c6d3cde
commit
563e8b49e8
@ -703,6 +703,7 @@ website = Website
|
||||
location = Location
|
||||
pronouns = Pronouns
|
||||
pronouns_custom = Custom
|
||||
pronouns_unspecified = Unspecified
|
||||
update_theme = Change theme
|
||||
update_profile = Update profile
|
||||
update_language = Change language
|
||||
|
@ -46,7 +46,7 @@ func Profile(ctx *context.Context) {
|
||||
ctx.Data["PageIsSettingsProfile"] = true
|
||||
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
|
||||
ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx)
|
||||
ctx.Data["PronounsAreCustom"] = ctx.Doer.Pronouns != "he/him" && ctx.Doer.Pronouns != "she/her" && ctx.Doer.Pronouns != "they/them" && ctx.Doer.Pronouns != "it/its"
|
||||
ctx.Data["PronounsAreCustom"] = ctx.Doer.Pronouns != "" && ctx.Doer.Pronouns != "he/him" && ctx.Doer.Pronouns != "she/her" && ctx.Doer.Pronouns != "they/them" && ctx.Doer.Pronouns != "it/its"
|
||||
|
||||
ctx.HTML(http.StatusOK, tplSettingsProfile)
|
||||
}
|
||||
@ -57,7 +57,7 @@ func ProfilePost(ctx *context.Context) {
|
||||
ctx.Data["PageIsSettingsProfile"] = true
|
||||
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
|
||||
ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx)
|
||||
ctx.Data["PronounsAreCustom"] = ctx.Doer.Pronouns != "he/him" && ctx.Doer.Pronouns != "she/her" && ctx.Doer.Pronouns != "they/them" && ctx.Doer.Pronouns != "it/its"
|
||||
ctx.Data["PronounsAreCustom"] = ctx.Doer.Pronouns != "" && ctx.Doer.Pronouns != "he/him" && ctx.Doer.Pronouns != "she/her" && ctx.Doer.Pronouns != "they/them" && ctx.Doer.Pronouns != "it/its"
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(http.StatusOK, tplSettingsProfile)
|
||||
|
@ -44,12 +44,15 @@
|
||||
<div class="text">
|
||||
{{if .PronounsAreCustom}}
|
||||
{{.locale.Tr "settings.pronouns_custom"}}
|
||||
{{else if eq "" .SignedUser.Pronouns}}
|
||||
{{.locale.Tr "settings.pronouns_unspecified"}}
|
||||
{{else}}
|
||||
{{.SignedUser.Pronouns}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
<div class="menu">
|
||||
<div class="item{{if eq "" .SignedUser.Pronouns}} active selected{{end}}" data-value=""><i>{{.locale.Tr "settings.pronouns_unspecified"}}</i></div>
|
||||
<div class="item{{if eq "he/him" .SignedUser.Pronouns}} active selected{{end}}" data-value="he/him">he/him</div>
|
||||
<div class="item{{if eq "she/her" .SignedUser.Pronouns}} active selected{{end}}" data-value="she/her">she/her</div>
|
||||
<div class="item{{if eq "they/them" .SignedUser.Pronouns}} active selected{{end}}" data-value="they/them">they/them</div>
|
||||
@ -57,7 +60,7 @@
|
||||
{{if .PronounsAreCustom}}
|
||||
<div class="item active selected" data-value="{{.SignedUser.Pronouns}}">{{.locale.Tr "settings.pronouns_custom"}}</div>
|
||||
{{else}}
|
||||
<div class="item" data-value="">{{.locale.Tr "settings.pronouns_custom"}}</div>
|
||||
<div class="item" data-value="!">{{.locale.Tr "settings.pronouns_custom"}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,15 +2,21 @@ import {hideElem, showElem} from '../utils/dom.js';
|
||||
|
||||
function onPronounsDropdownUpdate() {
|
||||
const pronounsCustom = document.getElementById('pronouns-custom');
|
||||
const pronounsInput = document.querySelector('#pronouns-dropdown input');
|
||||
const pronounsDropdown = document.getElementById('pronouns-dropdown');
|
||||
const pronounsInput = pronounsDropdown.querySelector('input');
|
||||
const isCustom = !(
|
||||
pronounsInput.value === '' ||
|
||||
pronounsInput.value === 'he/him' ||
|
||||
pronounsInput.value === 'she/her' ||
|
||||
pronounsInput.value === 'they/them' ||
|
||||
pronounsInput.value === 'it/its'
|
||||
);
|
||||
if (isCustom) {
|
||||
if (pronounsInput.value === '!') {
|
||||
pronounsCustom.value = '';
|
||||
} else {
|
||||
pronounsCustom.value = pronounsInput.value;
|
||||
}
|
||||
pronounsCustom.style.display = '';
|
||||
} else {
|
||||
pronounsCustom.style.display = 'none';
|
||||
|
Loading…
Reference in New Issue
Block a user