Fix display correct amount in transaction form
This commit is contained in:
parent
079c1ea4d0
commit
b55eb68118
4 changed files with 5 additions and 4 deletions
|
@ -1,2 +1,5 @@
|
|||
module TransactionsHelper
|
||||
def amount a
|
||||
a.zero? ? nil : number_with_precision(a/100.0, precision: 2)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
- if current_user
|
||||
%li.pure-menu-item
|
||||
= link_to current_user.name.capitalize, current_user, class: "pure-menu-link"
|
||||
%li.pure-menu-item
|
||||
= link_to "New Transaction", new_transaction_path, class: "pure-menu-link"
|
||||
- else
|
||||
= link_to "Sign in", user_omniauth_authorize_path(:zeuswpi), class: "pure-menu-link" unless current_user
|
||||
.pure-u-1
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
= f.text_field :message, required: true, placeholder: "Message", size: 75
|
||||
%fieldset.pure-group-inline
|
||||
%span.euro.pure-group-addon
|
||||
= f.number_field :euros, value: (@transaction.amount.zero? ? nil : @transaction.amount/100),
|
||||
= f.number_field :euros, value: amount(@transaction.amount),
|
||||
placeholder: "Bedrag", step: 0.01, min: 0.01, class: "pure-group-addon price", size: 20, required: true
|
||||
= f.submit "Send it!", class: "pure-button pure-button-primary"
|
||||
|
|
|
@ -5,6 +5,6 @@ Rails.application.routes.draw do
|
|||
|
||||
root to: 'high_voltage/pages#show', id: "landing"
|
||||
|
||||
resources :transactions, only: [:new, :index, :create]
|
||||
resources :transactions, only: [:index, :create]
|
||||
resources :users, only: [:show, :index]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue