diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..c9cdb01 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 5ffcc59..5260746 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -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'