feat: extend teamer dashboard
This commit is contained in:
@@ -16,6 +16,7 @@ class AppExtension extends AbstractExtension
|
||||
new TwigFilter('file_icon', [AppRuntime::class, 'fileIconFilter'], ['is_safe' => ['html']]),
|
||||
new TwigFilter('date_diff', [AppRuntime::class, 'dateDiffForHumans']),
|
||||
new TwigFilter('format_money', [AppRuntime::class, 'formatMoney']),
|
||||
new TwigFilter('format_rating', [AppRuntime::class, 'formatRating'], ['is_safe' => ['html']]),
|
||||
new TwigFilter('license_label', [AppRuntime::class, 'licenseLabel']),
|
||||
new TwigFilter('teamer_status_label', [AppRuntime::class, 'teamerStatusLabel']),
|
||||
new TwigFilter('bpn_country_label', [AppRuntime::class, 'bpnCountryLabel']),
|
||||
|
||||
@@ -89,6 +89,14 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
return $this->intlExtension->formatCurrency($amount, 'EUR');
|
||||
}
|
||||
|
||||
public function formatRating(int $rating): string
|
||||
{
|
||||
// Ratings are stored as integers so divide by 100 first
|
||||
$rating = $rating / 100;
|
||||
|
||||
return 'Ø '.$this->intlExtension->formatNumber($rating, ['fraction_digit' => 2]);
|
||||
}
|
||||
|
||||
public function renderIcon(Environment $environment, string $icon, string $classes = 'w-5 h-5'): string
|
||||
{
|
||||
return $environment->render('_partials/_icon.html.twig', [
|
||||
|
||||
Reference in New Issue
Block a user