Skip to content
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

Fix decimal display for euro currency #937

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions app/views/shared/_value_heading.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
<p class="text-sm text-gray-500 font-medium"><%= label %></p>
<p class="text-gray-900 -space-x-0.5">
<% if value.is_a?(Money) %>
<span class="text-gray-500"><%= value.currency.symbol %></span>
<span class="<%= size == "lg" ? "text-xl" : "text-lg" %> font-medium"><%= format_money_without_symbol value, precision: 0 %></span>
<%- if value.currency.default_precision.positive? -%>
<span class="text-gray-500">
<%= value.currency.separator %><%= value.cents_str %>
</span>
<% end %>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this comment for more detail behind this change.

Due to the vast number of currencies, this approach will simplify display of currency values significantly.

<span class="<%= size == "lg" ? "text-xl" : "text-lg" %> font-medium"><%= format_money value %></span>
<% else %>
<span class="<%= size == "lg" ? "text-xl" : "text-lg" %> font-medium"><%= is_percentage ? number_to_percentage(value, precision: 2) : value %></span>
<% end %>
Expand Down
Loading