diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 0dbf3d9..cd5f04b 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -6,6 +6,10 @@ class RequestsController < ApplicationController def index @requests = @user.incoming_requests.group_by(&:status) + respond_to do |format| + format.html { } + format.json { render json: @requests } + end end def confirm diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index d53b65b..32f3611 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -55,7 +55,7 @@ %input.live-updating.value-thing{type: 'text', placeholder: 'Filter on Message', class: "form-control" } -%table#transactions.pure-table.pure-table-striped{data: { source: user_transactions_path(@user) }} +%table#transactions.pure-table.pure-table-striped{data: { source: user_transactions_datatable_path(@user) }} %thead %tr %th Time diff --git a/config/routes.rb b/config/routes.rb index bfa1946..0ba1ba5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,7 @@ Rails.application.routes.draw do root to: 'pages#sign_in_page' - resources :transactions, only: [:index, :create] + resources :transactions, only: [:create] resources :users, only: [:index, :show] do resources :requests, only: [:index], shallow: true do post :confirm @@ -22,8 +22,9 @@ Rails.application.routes.draw do resources :notifications, only: [:index], shallow: true do post :read end + resources :transactions, only: [:index], shallow: true post :reset_key, on: :member end - get 'datatables/:id' => 'datatables#transactions_for_user', as: "user_transactions" + get 'datatables/:id' => 'datatables#transactions_for_user', as: "user_transactions_datatable" end