Skip to content

Commit

Permalink
Fix gender administration
Browse files Browse the repository at this point in the history
  • Loading branch information
rande committed May 7, 2013
1 parent e045c75 commit f675f70
Show file tree
Hide file tree
Showing 19 changed files with 209 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Admin/Model/UserAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\UserBundle\Model\UserInterface;

use FOS\UserBundle\Model\UserManagerInterface;

Expand Down Expand Up @@ -119,7 +120,15 @@ protected function configureFormFields(FormMapper $formMapper)
->add('lastname', null, array('required' => false))
->add('website', 'url', array('required' => false))
->add('biography', 'text', array('required' => false))
->add('gender', 'textarea', array('required' => false))
->add('gender', 'choice', array(
'choices' => array(
UserInterface::GENDER_UNKNOWN => 'gender_unknown',
UserInterface::GENDER_FEMALE => 'gender_female',
UserInterface::GENDER_MAN => 'gender_male',
),
'required' => true,
'translation_domain' => $this->getTranslationDomain()
))
->add('locale', 'locale', array('required' => false))
->add('timezone', 'timezone', array('required' => false))
->add('phone', null, array('required' => false))
Expand Down
2 changes: 1 addition & 1 deletion Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ abstract class User extends AbstractedUser implements UserInterface
/**
* @var string
*/
protected $gender;
protected $gender = UserInterface::GENDER_UNKNOWN; // set the default to unknown

/**
* @var string
Expand Down
4 changes: 4 additions & 0 deletions Model/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

interface UserInterface extends \FOS\UserBundle\Model\UserInterface
{
const GENDER_FEMALE = 'f';
const GENDER_MAN = 'm';
const GENDER_UNKNOWN = 'u';

/**
* @return string
*/
Expand Down
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.bg.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@
<source>label_two_step_code_error</source>
<target>Верификационния код е невалиден</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
13 changes: 12 additions & 1 deletion Resources/translations/SonataUserBundle.ca.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,18 @@
<source>show.label_two_step_verification_code</source>
<target>Codi de verificación de dos pasos</target>
</trans-unit>

<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.cs.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@
<source>form.label_date_of_birth</source>
<target>Date of birth</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.de.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,18 @@
<source>field.label_roles_editable</source>
<target>Rollen</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,18 @@
<source>breadcrumb.link_user_show</source>
<target>Show</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.es.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,18 @@
<source>breadcrumb.link_user_show</source>
<target>Mostrar</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.fa.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,18 @@
<source>breadcrumb.link_user_show</source>
<target>نمایش</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
Expand Down
14 changes: 13 additions & 1 deletion Resources/translations/SonataUserBundle.fr.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<trans-unit id="filter.label_name">
<source>filter.label_name</source>
<target>Nom</target>
</trans-unit>
</trans-unit>
<trans-unit id="filter.label_email">
<source>filter.label_email</source>
<target>Email</target>
Expand Down Expand Up @@ -402,6 +402,18 @@
<source>breadcrumb.link_user_show</source>
<target>Voir</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>non défini</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>femme</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>homme</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.it.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@
<source>form.label_date_of_birth</source>
<target>Date of birth</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.nl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,18 @@
<source>name</source>
<target>Naam</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.pl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,18 @@
<source>form.label_date_of_birth</source>
<target>Data urodzin</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
24 changes: 24 additions & 0 deletions Resources/translations/SonataUserBundle.pt.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,30 @@
<source>form.label_date_of_birth</source>
<target>Date of birth</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
1 change: 1 addition & 0 deletions Resources/translations/SonataUserBundle.ru.xliff
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="" >
Expand Down
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.sk.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@
<source>form.label_date_of_birth</source>
<target>Date of birth</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.sl.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,18 @@
<source>breadcrumb.link_user_show</source>
<target>Uporabnik</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>
12 changes: 12 additions & 0 deletions Resources/translations/SonataUserBundle.zh_TW.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@
<source>form.label_date_of_birth</source>
<target>Date of birth</target>
</trans-unit>
<trans-unit id="gender_unknown">
<source>gender_unknown</source>
<target>gender_unknown</target>
</trans-unit>
<trans-unit id="gender_female">
<source>gender_female</source>
<target>gender_female</target>
</trans-unit>
<trans-unit id="gender_male">
<source>gender_male</source>
<target>gender_male</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit f675f70

Please sign in to comment.