displaying percent need twig/intl-extra
This commit is contained in:
parent
9eee3c119b
commit
2c18b10aa0
@ -25,6 +25,7 @@
|
|||||||
"symfony/webpack-encore-bundle": "^1.11",
|
"symfony/webpack-encore-bundle": "^1.11",
|
||||||
"symfony/yaml": "5.2.*",
|
"symfony/yaml": "5.2.*",
|
||||||
"twig/extra-bundle": "^2.12|^3.0",
|
"twig/extra-bundle": "^2.12|^3.0",
|
||||||
|
"twig/intl-extra": "^3.3",
|
||||||
"twig/twig": "^2.12|^3.0"
|
"twig/twig": "^2.12|^3.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
69
app/composer.lock
generated
69
app/composer.lock
generated
@ -5942,6 +5942,75 @@
|
|||||||
],
|
],
|
||||||
"time": "2021-02-06T21:13:17+00:00"
|
"time": "2021-02-06T21:13:17+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "twig/intl-extra",
|
||||||
|
"version": "v3.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/twigphp/intl-extra.git",
|
||||||
|
"reference": "919e8f945c30bd3efeb6a4d79722cda538116658"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/twigphp/intl-extra/zipball/919e8f945c30bd3efeb6a4d79722cda538116658",
|
||||||
|
"reference": "919e8f945c30bd3efeb6a4d79722cda538116658",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1.3",
|
||||||
|
"symfony/intl": "^4.3|^5.0",
|
||||||
|
"twig/twig": "^2.4|^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/phpunit-bridge": "^4.4.9|^5.0.9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.2-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Twig\\Extra\\Intl\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com",
|
||||||
|
"homepage": "http://fabien.potencier.org",
|
||||||
|
"role": "Lead Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A Twig extension for Intl",
|
||||||
|
"homepage": "https://twig.symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"intl",
|
||||||
|
"twig"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/twigphp/intl-extra/tree/v3.3.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-01-01T14:58:18+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/twig",
|
"name": "twig/twig",
|
||||||
"version": "v3.3.0",
|
"version": "v3.3.0",
|
||||||
|
@ -4,6 +4,8 @@ namespace App\Form;
|
|||||||
|
|
||||||
use App\Entity\Beer;
|
use App\Entity\Beer;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\PercentType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
@ -12,8 +14,11 @@ class BeerType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name')
|
->add('name', TextType::class)
|
||||||
->add('alcool')
|
->add('alcool', PercentType::class, [
|
||||||
|
'scale' => 1,
|
||||||
|
'type' => 'fractional',
|
||||||
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +385,9 @@
|
|||||||
"twig/extra-bundle": {
|
"twig/extra-bundle": {
|
||||||
"version": "v3.3.0"
|
"version": "v3.3.0"
|
||||||
},
|
},
|
||||||
|
"twig/intl-extra": {
|
||||||
|
"version": "v3.3.0"
|
||||||
|
},
|
||||||
"twig/twig": {
|
"twig/twig": {
|
||||||
"version": "v3.3.0"
|
"version": "v3.3.0"
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ beer.id }}</th>
|
<th scope="row">{{ beer.id }}</th>
|
||||||
<td>{{ beer.name }}</td>
|
<td>{{ beer.name }}</td>
|
||||||
<td>{{ beer.alcool }}</td>
|
<td>{{ beer.alcool|format_percent_number({rounding_mode: 'floor', fraction_digit: 1}) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('beer_show', {'id': beer.id}) }}" class="btn btn-secondary" role="button" title="{{'show'}}">
|
<a href="{{ path('beer_show', {'id': beer.id}) }}" class="btn btn-secondary" role="button" title="{{'show'}}">
|
||||||
<i class="fa fa-eye fa-fw"></i>
|
<i class="fa fa-eye fa-fw"></i>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{'Alcool'}}</th>
|
<th scope="row">{{'Alcool'}}</th>
|
||||||
<td>{{ beer.alcool }}</td>
|
<td>{{ beer.alcool|format_percent_number({rounding_mode: 'floor', fraction_digit: 1}) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user