diefstal is een misdrijf

This commit is contained in:
benji 2015-09-11 15:50:07 +02:00
parent 670d748d40
commit 3ec19abab3
4 changed files with 7 additions and 15 deletions

View file

@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception|
respond_to do |format|
format.json { render nothing: true, status: :forbidden }
format.json { render json: [ "Diefstal is een misdrijf." ], status: :forbidden }
format.html { redirect_to root_url, alert: exception.message }
end
end

View file

@ -10,16 +10,11 @@ class TransactionsController < ApplicationController
@transactions = Transaction.all
end
def new
@transaction = Transaction.new
end
def create
transaction = Transaction.new(transaction_params)
if transaction.save
if @transaction.save
head :created
else
render json: transaction.errors.full_messages, status: :unprocessable_entity
render json: @transaction.errors.full_messages, status: :unprocessable_entity
end
end

View file

@ -1,4 +1,4 @@
#transaction_errors.panel.panel-error.hidden
#transaction_errors.panel.panel-danger.hidden
.panel-heading
%h3.panel-title
This transaction could not be saved.

View file

@ -7,15 +7,12 @@
= f.select :creditor,
options_from_collection_for_select(User.all.order(:name), :name, :name),
{ include_blank: true },
{ class: 'select2-selector form-control', size: 50 }
-# { class: 'select2-selector', size: 50, required: true }
= f.text_field :message, placeholder: "Message", size: 75, class: "form-control"
-# = f.text_field :message, required: true, placeholder: "Message", size: 75
{ class: 'select2-selector form-control', size: 50, required: true }
= f.text_field :message, placeholder: "Message", size: 75, class: "form-control", required: true
.input-group
%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
-# placeholder: "Bedrag", step: 0.01, min: 0.01, class: "pure-group-addon price", size: 20, required: true
class: "form-control", size: 20, required: true
= f.submit "Send it!", class: "pure-button pure-button-primary"