Format the balance of user
This commit is contained in:
parent
8306271bd9
commit
36fbf1a8f8
2 changed files with 14 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue