Format the balance of user

This commit is contained in:
benji 2016-02-17 15:45:00 +01:00
parent 8306271bd9
commit 36fbf1a8f8
2 changed files with 14 additions and 1 deletions

View file

@ -1,2 +1,13 @@
module ApplicationHelper
def euro f
number_to_currency f, unit: '€'
end
def euro_from_cents(f)
if f
euro (f / 100.0)
else
nil
end
end
end

View file

@ -1,4 +1,6 @@
%h2= "#{@user.name} (balance: #{@user.balance/100.0})"
%h2
= @user.name
%small= "balance: #{euro_from_cents @user.balance}"
= render 'transactions/new'