More stuff

This commit is contained in:
benji 2016-02-02 17:49:32 +01:00
parent aa2b22358a
commit 4faf3e36ab
4 changed files with 4 additions and 4 deletions

View file

@ -78,7 +78,7 @@ ready = function() {
$(flash_success).removeClass("hidden"); $(flash_success).removeClass("hidden");
$(errors).addClass("hidden"); $(errors).addClass("hidden");
$(form)[0].reset(); $(form)[0].reset();
$('#transaction_creditor').select2('data', null); $('#transaction_creditor').select2('val', null);
}).on("ajax:error", function(xhr, status, error) { }).on("ajax:error", function(xhr, status, error) {
$(errors).removeClass("hidden"); $(errors).removeClass("hidden");
$(panel_ul).empty(); $(panel_ul).empty();

View file

@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
end end
def authenticate_user_or_client! def authenticate_user_or_client!
current_user || current_client || head(:unauthorized) current_user || current_client || redirect_to(root_path, flash: { notice: "You have been redirected." })
end end
def current_client def current_client

View file

@ -7,7 +7,7 @@ class UsersController < ApplicationController
load_and_authorize_resource except: :show load_and_authorize_resource except: :show
def show def show
@user = User.find_by_name(params[:id]) || User.new @user = User.find_or_create_by(name: params[:id])
respond_to do |format| respond_to do |format|
format.html { @transaction = Transaction.new } format.html { @transaction = Transaction.new }
format.json { render json: @user } format.json { render json: @user }

View file

@ -14,5 +14,5 @@
%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, required: true class: "form-control", size: 20, max: 100, required: true
= f.submit "Send it!", class: "pure-button pure-button-primary btn" = f.submit "Send it!", class: "pure-button pure-button-primary btn"