dustin / money

My money tracking app. There are many like it, but this one is mine.

This URL has Read+Write access

money / app / views / txn / index.html.haml
100644 58 lines (50 sloc) 1.644 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%h1= @page_title
 
%table.transaction_list
  %thead
    %tr
      %th Clear
      %th Txn ID
      %th Date
      %th User
      %th Category
      %th Amount
      %th Description
  %tbody
    - @transactions.each do |t|
      %tr{:class => cycle('odd', 'even') + (t.deleted_at ? ' deleted' : '') }
        %td
          %form{:method => "put", :action => '#'}
            - checked = t.reconciled ? {:checked => "1"} : {}
            %input{checked.merge(:type => "checkbox", :id => "txn_#{t.id}")}
        %td= t.id
        %td= t.ds
        %td= t.user.login
        %td
          %span{:id => "txn_cat_#{t.id}"}= t.category.name
        %td.moneycolumn= currency_span(t.amount)
        %td
          %span{:id => "txn_desc_#{t.id}"}= t.descr
 
.txnsummary
  Showing
  = @transactions.length
  == #{maybe_singular(@transactions.length, "transactions")}.
 
%p
  Ending balance:
  = currency_span(@txn_sum, 'endingbal')
  %br
  Reconciled balance:
  = currency_span(@rec_sum, 'reconciled')
  %br
  Unreconciled balance:
  = currency_span(@unrec_sum, 'unreconciled')
 
%p= render :partial => 'links'
 
%script{:type => "text/javascript"}
  - if @current_acct
    - rec_url = "/txn/current_reconciled?acct_id=#{@current_acct.id}"
    == function updateReconciled() { new Ajax.Request('#{rec_url}' + "&r=" + Math.random(), {evalScripts: true}) }
  - else
    updateReconciled = false
  == var known_cats = [ #{@current_group.categories.map{|c| "'#{c.name}'"}.sort.join(", ")} ];
 
  function setuptxedit(aid, id) { setup_txn_editors(aid, id, known_cats, updateReconciled) }
 
  - @transactions.each do |t|
    == setuptxedit(#{t.account.id}, #{t.id});