Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Commit

Permalink
[#8] Sort open invoices by creation time and show humanized open dura…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
jtgeibel committed Jun 3, 2014
1 parent a1805a9 commit fc16827
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class WelcomeController < ApplicationController
def index
@invoices = Invoice.all.to_a
@invoices = Invoice.order(created_at: :desc).to_a
@total_invoiced = @invoices.map {|i| i.total}.sum
@total_payments_received = Payment.sum :amount
@total_invoices_unpaid = @total_invoiced - @total_payments_received
Expand Down
5 changes: 5 additions & 0 deletions app/views/welcome/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
%tr
%th Sponsor
%th Balance
%th Created
%tbody
- @open_invoices.each do |invoice|
%tr
%td= link_to invoice.sponsor.name, invoice.sponsor
%td= number_to_currency invoice.balance
%td
= time_tag invoice.created_at do
#{time_ago_in_words invoice.created_at} ago


.panel.panel-primary
%h2.panel-heading.panel-title Payments
Expand Down

0 comments on commit fc16827

Please sign in to comment.