show all transactions on index, show user transactions on user show
This commit is contained in:
parent
b30e1fb438
commit
2c1c92edb3
3 changed files with 13 additions and 5 deletions
|
@ -15,7 +15,7 @@ class TransactionsController < ApplicationController
|
|||
current_user: current_user
|
||||
)
|
||||
@grid = TransactionsGrid.new(gridparams) do |scope|
|
||||
scope.where('debtor_id = :id OR creditor_id = :id', id: current_user).page(params[:page])
|
||||
scope.page(params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,8 +4,15 @@ class UsersController < ApplicationController
|
|||
def show
|
||||
@user = User.find(params[:id])
|
||||
@transaction = Transaction.new
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
||||
gridparams = params[:transactions_grid] || Hash.new
|
||||
gridparams = gridparams.merge(
|
||||
order: :created_at,
|
||||
descending: true,
|
||||
current_user: current_user
|
||||
)
|
||||
@grid = TransactionsGrid.new(gridparams) do |scope|
|
||||
scope.where('debtor_id = :id OR creditor_id = :id', id: current_user).page(params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
%tr{:class => "#{options[:cycle] cycle(*options[:cycle])}"}
|
||||
%tr{class: "#{options[:cycle] && cycle(*options[:cycle])}"}
|
||||
- grid.html_columns(*options[:columns]).each do |column|
|
||||
%td{:class => "#{datagrid_column_classes(grid, column)}"}= datagrid_value(grid, column, asset)
|
||||
%td{:class => "#{datagrid_column_classes(grid, column)}"}
|
||||
= datagrid_value(grid, column, asset)
|
||||
|
|
Loading…
Reference in a new issue