Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

add any/all pronoun option to dropdown

This commit is contained in:
hazycora 2023-09-26 12:54:18 -05:00
parent 708327a548
commit 12e00abe29
No known key found for this signature in database
GPG key ID: 215AF1F81F86940E
3 changed files with 5 additions and 3 deletions

View file

@ -46,7 +46,7 @@ func Profile(ctx *context.Context) {
ctx.Data["PageIsSettingsProfile"] = true ctx.Data["PageIsSettingsProfile"] = true
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx) ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx)
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.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.Doer.Pronouns != "any/all"
ctx.HTML(http.StatusOK, tplSettingsProfile) ctx.HTML(http.StatusOK, tplSettingsProfile)
} }
@ -57,7 +57,7 @@ func ProfilePost(ctx *context.Context) {
ctx.Data["PageIsSettingsProfile"] = true ctx.Data["PageIsSettingsProfile"] = true
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx) ctx.Data["DisableGravatar"] = setting.Config().Picture.DisableGravatar.Value(ctx)
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.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.Doer.Pronouns != "any/all"
if ctx.HasError() { if ctx.HasError() {
ctx.HTML(http.StatusOK, tplSettingsProfile) ctx.HTML(http.StatusOK, tplSettingsProfile)

View file

@ -57,6 +57,7 @@
<div class="item{{if eq "she/her" .SignedUser.Pronouns}} active selected{{end}}" data-value="she/her">she/her</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> <div class="item{{if eq "they/them" .SignedUser.Pronouns}} active selected{{end}}" data-value="they/them">they/them</div>
<div class="item{{if eq "it/its" .SignedUser.Pronouns}} active selected{{end}}" data-value="it/its">it/its</div> <div class="item{{if eq "it/its" .SignedUser.Pronouns}} active selected{{end}}" data-value="it/its">it/its</div>
<div class="item{{if eq "any/all" .SignedUser.Pronouns}} active selected{{end}}" data-value="any/all">any/all</div>
{{if .PronounsAreCustom}} {{if .PronounsAreCustom}}
<div class="item active selected" data-value="{{.SignedUser.Pronouns}}"><i>{{.locale.Tr "settings.pronouns_custom"}}</i></div> <div class="item active selected" data-value="{{.SignedUser.Pronouns}}"><i>{{.locale.Tr "settings.pronouns_custom"}}</i></div>
{{else}} {{else}}

View file

@ -9,7 +9,8 @@ function onPronounsDropdownUpdate() {
pronounsInput.value === 'he/him' || pronounsInput.value === 'he/him' ||
pronounsInput.value === 'she/her' || pronounsInput.value === 'she/her' ||
pronounsInput.value === 'they/them' || pronounsInput.value === 'they/them' ||
pronounsInput.value === 'it/its' pronounsInput.value === 'it/its' ||
pronounsInput.value === 'any/all'
); );
if (isCustom) { if (isCustom) {
if (pronounsInput.value === '!') { if (pronounsInput.value === '!') {