From db63f30a76499c40975e095f0ea2357da80507fb Mon Sep 17 00:00:00 2001 From: Pierre de Lacroix Date: Mon, 17 Apr 2017 22:09:25 +0200 Subject: [PATCH] cosmetic fixes to the ticket view --- app/views/spree/admin/orders/ticket.html.haml | 20 +++++++++---------- config/locales/fr.yml | 4 ++-- lib/spree/money_decorator.rb | 3 +++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/views/spree/admin/orders/ticket.html.haml b/app/views/spree/admin/orders/ticket.html.haml index 53f224cff1..ea0dc2c913 100644 --- a/app/views/spree/admin/orders/ticket.html.haml +++ b/app/views/spree/admin/orders/ticket.html.haml @@ -26,7 +26,7 @@ '\x1B' + '\x61' + '\x30', // left align '\x0A', '\x1B' + '\x4D' + '\x31', // small text - "#{'%6s %-23s%12s%12s' % + "#{'%6s %-26s%10s%10s' % [t(:ticket_column_qty), t(:ticket_column_item), t(:ticket_column_unit_price), @@ -39,8 +39,8 @@ .map { |line_item| '%5d %-19.19s%8.8s%8.8s' % [line_item.quantity, line_item.product.name, - line_item.single_display_amount_with_adjustments.money.format(symbol: false), - line_item.display_amount_with_adjustments.money.format(symbol: false)] } + line_item.single_display_amount_with_adjustments.format(symbol: false, with_currency: false), + line_item.display_amount_with_adjustments.format(symbol: false, with_currency: false)] } .join('" + \'\x0A\' + "')}", '\x0A', "#{checkout_adjustments_for(@order, exclude: [:line_item]) @@ -48,26 +48,24 @@ .reverse.map { |adjustment| '%5s %-27.27s%8.8s' % ["", raw(adjustment.label), - display_adjustment_amount(adjustment).money.format(symbol: false)] } - .join('" + \'\x0A\' + "')}", - '\x0A', + display_adjustment_amount(adjustment).format(symbol: false, with_currency: false)] + + '" + \'\x0A\' + "'}.join }", '__________________________________________' + '\x0A', '\x0A', '\x1B' + '\x45' + '\x0D', // bold on "#{'%31s%10s' % [t(:total_incl_tax), - @order.display_total]}", + @order.display_total.format(with_currency: false)]}", '\x1B' + '\x45' + '\x0A', // bold off '\x0A', "#{display_checkout_taxes_hash(@order).map { |tax_rate, tax_value| '%31s%10s' % [t(:tax_total, rate: tax_rate), - tax_value] } - .join('" + \'\x0A\' + "')}", - '\x0A', + tax_value.format(with_currency: false)] + + '" + \'\x0A\' + "'}.join }", "#{'%31s%10s' % [t(:total_excl_tax), - display_checkout_total_less_tax(@order)]}", + display_checkout_total_less_tax(@order).format(with_currency: false)]}", '\x0A', '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A', '\x1B' + '\x69', // cut paper diff --git a/config/locales/fr.yml b/config/locales/fr.yml index fc7c6c3111..088acf1481 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -513,8 +513,8 @@ fr: date_of_transaction: "Date de la transaction :" ticket_column_qty: "Qté" ticket_column_item: "Produit" - ticket_column_unit_price: "Prix unitaire" - ticket_column_total_price: "Prix total" + ticket_column_unit_price: "Px unit" + ticket_column_total_price: "Px total" logo: "Logo (640x130)" logo_mobile: "Logo smartphone (75x26)" logo_mobile_svg: "Logo smartphone (SVG)" diff --git a/lib/spree/money_decorator.rb b/lib/spree/money_decorator.rb index 755041df0e..0194925d4e 100644 --- a/lib/spree/money_decorator.rb +++ b/lib/spree/money_decorator.rb @@ -20,4 +20,7 @@ Spree::Money.class_eval do output end + def format(options={}) + @money.format(@options.merge!(options)) + end end