mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
wip: use GenderIconEnum to allow user to select bootstrap icon
This commit is contained in:
parent
67a6eb17db
commit
567c01f395
@ -30,8 +30,8 @@ class Gender
|
|||||||
private GenderEnum $genderTranslation;
|
private GenderEnum $genderTranslation;
|
||||||
|
|
||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, enumType: GenderIconEnum::class)]
|
||||||
private string $icon = '';
|
private GenderIconEnum $icon;
|
||||||
|
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])]
|
||||||
private float $order = 0;
|
private float $order = 0;
|
||||||
@ -71,12 +71,12 @@ class Gender
|
|||||||
$this->$genderTranslation = $genderTranslation;
|
$this->$genderTranslation = $genderTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIcon(): string
|
public function getIcon(): GenderIconEnum
|
||||||
{
|
{
|
||||||
return $this->icon;
|
return $this->icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setIcon(string $icon): void
|
public function setIcon(GenderIconEnum $icon): void
|
||||||
{
|
{
|
||||||
$this->icon = $icon;
|
$this->icon = $icon;
|
||||||
}
|
}
|
||||||
|
12
src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php
Normal file
12
src/Bundle/ChillMainBundle/Entity/GenderIconEnum.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
|
enum GenderIconEnum: string
|
||||||
|
{
|
||||||
|
case MALE = 'bi bi-gender-male';
|
||||||
|
case FEMALE = 'bi bi-gender-female';
|
||||||
|
case NEUTRAL = 'bi bi-gender-neuter';
|
||||||
|
case AMBIGUOUS = 'bi bi-gender-ambiguous';
|
||||||
|
case TRANS = 'bi bi-gender-trans';
|
||||||
|
}
|
@ -4,6 +4,7 @@ namespace Chill\MainBundle\Form;
|
|||||||
|
|
||||||
use Chill\MainBundle\Entity\Gender;
|
use Chill\MainBundle\Entity\Gender;
|
||||||
use Chill\MainBundle\Entity\GenderEnum;
|
use Chill\MainBundle\Entity\GenderEnum;
|
||||||
|
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@ -20,7 +21,13 @@ class GenderType extends AbstractType
|
|||||||
->add('label', TranslatableStringFormType::class, [
|
->add('label', TranslatableStringFormType::class, [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
->add('icon', TextType::class)
|
->add('icon', ChoiceType::class, [
|
||||||
|
'choices' => GenderIconEnum::cases(),
|
||||||
|
'expanded' => true,
|
||||||
|
'multiple' => false,
|
||||||
|
'mapped' => true,
|
||||||
|
'label' => 'Select Gender Icon',
|
||||||
|
])
|
||||||
->add('genderTranslation', ChoiceType::class, [
|
->add('genderTranslation', ChoiceType::class, [
|
||||||
'choices' => GenderEnum::cases(),
|
'choices' => GenderEnum::cases(),
|
||||||
'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)),
|
'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)),
|
||||||
|
@ -10,6 +10,7 @@ import Modal from 'bootstrap/js/dist/modal';
|
|||||||
import Collapse from 'bootstrap/js/src/collapse';
|
import Collapse from 'bootstrap/js/src/collapse';
|
||||||
import Carousel from 'bootstrap/js/src/carousel';
|
import Carousel from 'bootstrap/js/src/carousel';
|
||||||
import Popover from 'bootstrap/js/src/popover';
|
import Popover from 'bootstrap/js/src/popover';
|
||||||
|
import 'bootstrap-icons/font/bootstrap-icons.css';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Carousel: ACHeaderSlider is a small slider used in banner of AccompanyingCourse Section
|
// Carousel: ACHeaderSlider is a small slider used in banner of AccompanyingCourse Section
|
||||||
@ -59,4 +60,4 @@ const popoverList = triggerList.map(function (el) {
|
|||||||
return new Popover(el, {
|
return new Popover(el, {
|
||||||
html: true,
|
html: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -85,12 +85,8 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</div>
|
</div>
|
||||||
{%- if options['addInfo'] -%}
|
{%- if options['addInfo'] -%}
|
||||||
{% set gender = (person.gender == 'woman') ? 'fa-venus' :
|
|
||||||
(person.gender == 'man') ? 'fa-mars' : (person.gender == 'both') ? 'fa-neuter' : 'fa-genderless' %}
|
|
||||||
{% set genderTitle = (person.gender == 'woman') ? 'woman' :
|
|
||||||
(person.gender == 'man') ? 'man' : (person.gender == 'both') ? 'both' : 'Not given'|trans %}
|
|
||||||
<p class="moreinfo">
|
<p class="moreinfo">
|
||||||
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle|trans }}"></i>
|
<i class="{{ person.gender.icon }}" title="{{ person.gender.label|localize_translatable_string }}"></i>
|
||||||
|
|
||||||
{%- if person.deathdate is not null -%}
|
{%- if person.deathdate is not null -%}
|
||||||
{%- if person.birthdate is not null -%}
|
{%- if person.birthdate is not null -%}
|
||||||
|
@ -3,13 +3,14 @@ Born the date: >-
|
|||||||
man {Né le {birthdate}}
|
man {Né le {birthdate}}
|
||||||
woman {Née le {birthdate}}
|
woman {Née le {birthdate}}
|
||||||
neutral {Né·e le {birthdate}}
|
neutral {Né·e le {birthdate}}
|
||||||
|
other {Né·e le {birthdate}}
|
||||||
}
|
}
|
||||||
|
|
||||||
Requestor: >-
|
Requestor: >-
|
||||||
{gender, select,
|
{gender, select,
|
||||||
man {Demandeur}
|
man {Demandeur}
|
||||||
woman {Demandeuse}
|
woman {Demandeuse}
|
||||||
other {Demandeur·euse}
|
neutral {Demandeur·euse}
|
||||||
}
|
}
|
||||||
|
|
||||||
person:
|
person:
|
||||||
@ -17,7 +18,7 @@ person:
|
|||||||
{gender, select,
|
{gender, select,
|
||||||
man {et lui-même}
|
man {et lui-même}
|
||||||
woman {et elle-même}
|
woman {et elle-même}
|
||||||
other {et lui·elle-même}
|
neutral {et lui·elle-même}
|
||||||
}
|
}
|
||||||
from_the: depuis le
|
from_the: depuis le
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user