diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6cb6f63..ef6b866 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -8,6 +8,7 @@ class UsersController < ApplicationController def show @user = User.find_by(name: params[:id]) || User.new + authorize! :read, @user respond_to do |format| format.html { @transaction = Transaction.new } format.json { render json: @user } diff --git a/app/views/transactions/_new.html.haml b/app/views/transactions/_new.html.haml index b304df0..cb4be2c 100644 --- a/app/views/transactions/_new.html.haml +++ b/app/views/transactions/_new.html.haml @@ -13,6 +13,7 @@ %span.input-group-addon %span.glyphicon.glyphicon-euro = f.number_field :euros, value: amount(@transaction.amount), - placeholder: "Bedrag", step: 0.01, min: (0.01 unless current_user.penning), - class: "form-control", size: 20, max: Rails.application.config.maximum_amount/100, required: true + placeholder: "Amount", step: 0.01, min: (0.01 unless current_user.penning), + class: "form-control", size: 20, required: true, + max: (Rails.application.config.maximum_amount/100 unless current_user.penning) = f.submit "Send it!", class: "pure-button pure-button-primary btn" diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 7216372..51c3a26 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,4 +1,4 @@ -%h2= @user.name +%h2= "#{@user.name} (balance: #{@user.balance/100.0})" = render 'transactions/new'