The current gender is now displayed in the input

This commit is contained in:
n1rwana 2022-09-08 16:24:38 +03:00
parent 2e031fb482
commit 0b9f415109
4 changed files with 9 additions and 4 deletions

View file

@ -167,8 +167,11 @@ final class UserPresenter extends OpenVKPresenter
if ($this->postParam("gender"))
if($this->postParam("gender") == "hide")
$user->setGender(NULL);
elseif($this->postParam("gender") == "other" && $this->postParam("other-gender-string"))
elseif($this->postParam("gender") == "other")
if($this->postParam("other-gender-string"))
$user->setGender($this->postParam("other-gender-string"));
else
$user->setGender(NULL);
else
$user->setGender($this->postParam("gender"));

View file

@ -143,13 +143,13 @@
</script>
<td>
<select name="gender" onchange="genderChanged(event)">
<option value="hide" n:attr="selected => $user->getRawGender() == NULL">{_hide}</option>
<option value="hide" n:attr="selected => $user->getRawGender() == NULL">{_hidden}</option>
<option value="female" n:attr="selected => $user->getRawGender() == 'female'">{_female}</option>
<option value="male" n:attr="selected => $user->getRawGender() == 'male'">{_male}</option>
<option value="non-binary" n:attr="selected => $user->getRawGender() == 'non-binary'">{_non-binary}</option>
<option value="other" n:attr="selected => $user->hasOtherGenderString()">{_other}</option>
</select>
<input id="other-gender-input" type="text" name="other-gender-string" placeholder="{_other_gender_placeholder}" style="display: {$user->hasOtherGenderString() ? 'inline' : 'none'};" />
<input id="other-gender-input" type="text" name="other-gender-string" placeholder="{_other_gender_placeholder}" style="display: {$user->hasOtherGenderString() ? 'inline' : 'none'};" n:attr="value => $user->hasOtherGenderString() ? $user->getGender() : ''" />
</td>
</tr>
<tr>

View file

@ -72,6 +72,7 @@
"non-binary" = "non-binary";
"other" = "other";
"other_gender_placeholder" = "I refer to myself as...";
"hidden" = "not specified";
"description" = "Description";
"save" = "Save";
"main_information" = "Main information";

View file

@ -74,6 +74,7 @@
"non-binary" = "небинарный";
"other" = "другой";
"other_gender_placeholder" = "Я идентифицирую себя как...";
"hidden" = "не указан";
"description" = "Описание";
"save" = "Сохранить";
"main_information" = "Основная информация";