avoid word-wrap when showing currency

This commit is contained in:
wvengen 2014-03-15 15:09:16 +01:00
parent 8853b3efdb
commit bb9269f755
2 changed files with 10 additions and 4 deletions

View File

@ -6,12 +6,12 @@ en:
number: number:
currency: currency:
format: format:
unit: ! '€ ' unit: ! "€\u202f"
nl: nl:
number: number:
currency: currency:
format: format:
delimiter: ! ' ' delimiter: ! "\u202f"
unit: ! '€ ' unit: ! "€\u202f"
format: format:
delimiter: ! ' ' delimiter: ! "\u202f"

View File

@ -11,6 +11,7 @@ class OrderPdf < Prawn::Document
#options[:bottom_margin] ||= 40 #options[:bottom_margin] ||= 40
super(options) super(options)
@order = order @order = order
@options = options
end end
def to_pdf def to_pdf
@ -29,4 +30,9 @@ class OrderPdf < Prawn::Document
def save_tmp def save_tmp
File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", 'w') {|f| f.write(to_pdf.force_encoding("UTF-8")) } File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", 'w') {|f| f.write(to_pdf.force_encoding("UTF-8")) }
end end
# XXX avoid underscore instead of unicode whitespace in pdf :/
def number_to_currency(number, options={})
super(number, options).gsub("\u202f", ' ')
end
end end