mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
Add Spree::Money#to_html (from Spree 2.0)
This commit is contained in:
@@ -9,4 +9,15 @@ Spree::Money.class_eval do
|
||||
@options[:no_cents] = true if @money.dollars % 1 == 0
|
||||
to_s
|
||||
end
|
||||
|
||||
def to_html(options = { :html => true })
|
||||
output = @money.format(@options.merge(options))
|
||||
if options[:html]
|
||||
# 1) prevent blank, breaking spaces
|
||||
# 2) prevent escaping of HTML character entities
|
||||
output = output.sub(" ", " ").html_safe
|
||||
end
|
||||
output
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user