Add card view for open outgoing requests
This commit is contained in:
parent
696c6aae53
commit
c94738123a
4 changed files with 23 additions and 4 deletions
|
@ -5,6 +5,7 @@ class PagesController < ApplicationController
|
|||
query = TransactionsQuery.new(current_user)
|
||||
@transactions = ActiveRecord::Base.connection.exec_query(query.query.order(query.arel_table[:time].desc).take(10).project(Arel.star).to_sql)
|
||||
@requests = current_user.incoming_requests.open.includes(:creditor).take(10)
|
||||
@outgoing_requests = current_user.outgoing_requests.open.includes(:debtor).take(10)
|
||||
@notifications = current_user.notifications.unread
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class User < ActiveRecord::Base
|
|||
has_many :incoming_requests,
|
||||
class_name: 'Request', foreign_key: 'debtor_id'
|
||||
has_many :outgoing_requests,
|
||||
class_name: 'Request', foreign_key: 'debtor_id'
|
||||
class_name: 'Request', foreign_key: 'creditor_id'
|
||||
has_many :notifications
|
||||
|
||||
has_many :issued_transactions, as: :issuer, class_name: 'Transaction'
|
||||
|
|
17
app/views/pages/_outgoing_requests.html.haml
Normal file
17
app/views/pages/_outgoing_requests.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
|||
.card-wrapper
|
||||
- if @outgoing_requests.any?
|
||||
.card
|
||||
.padded
|
||||
%h3 Outgoing Requests
|
||||
- @outgoing_requests.each do |r|
|
||||
.request.pure-g
|
||||
.pure-u-2-3
|
||||
%h4= r.message
|
||||
= r.debtor.name
|
||||
.pure-u-1-3.actions
|
||||
= euro_from_cents r.amount
|
||||
.clear-both
|
||||
- else
|
||||
.card.padded
|
||||
%span.info-message
|
||||
You have no open outgoing requests at the moment.
|
|
@ -5,3 +5,4 @@
|
|||
= render 'transaction_form'
|
||||
= render 'requests'
|
||||
= render 'notifications'
|
||||
= render 'outgoing_requests'
|
||||
|
|
Loading…
Reference in a new issue