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| rescue_from CanCan::AccessDenied do |exception|
respond_to do |format| 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 } format.html { redirect_to root_url, alert: exception.message }
end end
end end

View file

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

View file

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

View file

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