-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When "percent" field is NULL, show non breaking space instead of 0 #6632
Conversation
{%- if value is null -%} | ||
| ||
{%- else -%} | ||
{% set value = value * 100 %} | ||
{{ value }} % | ||
{%- endif -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a nbsp ?
{%- if value is null -%} | |
| |
{%- else -%} | |
{% set value = value * 100 %} | |
{{ value }} % | |
{%- endif -%} | |
{%- if value is not null -%} | |
{{ value * 100 }} % | |
{%- endif -%} |
Should be enough ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Years ago   was necessary to prevent problems with cells, but I don't think they are needed anymore. I used the same code as "display_datetime", "display_date" and "display_time" where also   is displayed when value is empty. Do you want me to change those too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't need them, let's avoid them indeed.
Elsewhere, but if it's for consistency, I won't block this PR.
{%- if value is null -%} | ||
| ||
{%- else -%} | ||
{{ field_description.options.currency }} {{ value }} | ||
{%- endif -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{%- if value is null -%} | |
| |
{%- else -%} | |
{{ field_description.options.currency }} {{ value }} | |
{%- endif -%} | |
{%- if value is not null -%} | |
{{ field_description.options.currency }} {{ value }} | |
{%- endif -%} |
Thanks @willemverspyck |
Subject
When using this code:
And the value of "rate" is NULL, the current return value is "0 %". I think the value must be " " for NULL and "0 %" for 0. Also return " " when currency is NULL.
Same change for configureShowFields.
I am targeting this branch, because it's BC.
Changelog
### Changed Twig templates: "list_percent", "show_percent", "list_currency" and "show_currency"