mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge money_decorator.rb with money.rb
The #rounded method was left out, as it appears to be dead code.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require 'spree/money_decorator'
|
||||
require 'spree/money'
|
||||
|
||||
module Spree
|
||||
module ReportsHelper
|
||||
|
||||
@@ -21,6 +21,11 @@ module Spree
|
||||
@options[:symbol_position] = @options[:symbol_position].to_sym
|
||||
end
|
||||
|
||||
# Return the currency symbol (on its own) for the current default currency
|
||||
def self.currency_symbol
|
||||
::Money.new(0, Spree::Config[:currency]).symbol
|
||||
end
|
||||
|
||||
def to_s
|
||||
@money.format(@options)
|
||||
end
|
||||
@@ -30,11 +35,15 @@ module Spree
|
||||
if options[:html]
|
||||
# 1) prevent blank, breaking spaces
|
||||
# 2) prevent escaping of HTML character entities
|
||||
output = output.gsub(" ", " ").html_safe
|
||||
output = output.sub(" ", " ").html_safe
|
||||
end
|
||||
output
|
||||
end
|
||||
|
||||
def format(options = {})
|
||||
@money.format(@options.merge!(options))
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
@money == other.money
|
||||
end
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
Spree::Money.class_eval do
|
||||
# return the currency symbol (on its own) for the current default currency
|
||||
def self.currency_symbol
|
||||
Money.new(0, Spree::Config[:currency]).symbol
|
||||
end
|
||||
|
||||
def rounded
|
||||
@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
|
||||
|
||||
def format(options = {})
|
||||
@money.format(@options.merge!(options))
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user