Fixed broken link on startpage for non ordergroup members.
This commit is contained in:
parent
ce375e1637
commit
116b1c4ed9
1 changed files with 29 additions and 23 deletions
|
@ -35,39 +35,45 @@ class HomeController < ApplicationController
|
||||||
def ordergroup
|
def ordergroup
|
||||||
@user = @current_user
|
@user = @current_user
|
||||||
@ordergroup = @user.ordergroup
|
@ordergroup = @user.ordergroup
|
||||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
|
||||||
@ordergroup_columns = ["description", "account_balance", "account_updated"]
|
|
||||||
|
|
||||||
#listing the financial transactions with ajax...
|
unless @ordergroup.nil?
|
||||||
|
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||||
|
@ordergroup_columns = ["description", "account_balance", "account_updated"]
|
||||||
|
|
||||||
if params['sort']
|
#listing the financial transactions with ajax...
|
||||||
sort = case params['sort']
|
|
||||||
when "date" then "created_on"
|
if params['sort']
|
||||||
when "note" then "note"
|
sort = case params['sort']
|
||||||
when "amount" then "amount"
|
when "date" then "created_on"
|
||||||
when "date_reverse" then "created_on DESC"
|
when "note" then "note"
|
||||||
when "note_reverse" then "note DESC"
|
when "amount" then "amount"
|
||||||
when "amount_reverse" then "amount DESC"
|
when "date_reverse" then "created_on DESC"
|
||||||
end
|
when "note_reverse" then "note DESC"
|
||||||
|
when "amount_reverse" then "amount DESC"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
sort = "created_on DESC"
|
sort = "created_on DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
# or if somebody uses the search field:
|
# or if somebody uses the search field:
|
||||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||||
|
|
||||||
@total = @ordergroup.financial_transactions.count(:conditions => conditions)
|
@total = @ordergroup.financial_transactions.count(:conditions => conditions)
|
||||||
@financial_transactions = @ordergroup.financial_transactions.paginate(:page => params[:page],
|
@financial_transactions = @ordergroup.financial_transactions.paginate(:page => params[:page],
|
||||||
:per_page => 10,
|
:per_page => 10,
|
||||||
:conditions => conditions,
|
:conditions => conditions,
|
||||||
:order => sort)
|
:order => sort)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # myOrdergroup.haml
|
format.html # myOrdergroup.haml
|
||||||
format.js { render :partial => "finance/transactions/list" }
|
format.js { render :partial => "finance/transactions/list" }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:error] = "Leider bist Du kein Mitglied einer Bestellgruppe"
|
||||||
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# cancel personal memberships direct from the myProfile-page
|
# cancel personal memberships direct from the myProfile-page
|
||||||
def cancel_membership
|
def cancel_membership
|
||||||
membership = Membership.find(params[:membership_id])
|
membership = Membership.find(params[:membership_id])
|
||||||
if membership.user == current_user
|
if membership.user == current_user
|
||||||
|
|
Loading…
Reference in a new issue