]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
added a 'My Share' column to lists of expenditures
[bluechips.git] / bluechips / templates / base.mako
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4   <head>
5     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6     <title>${self.title()}</title>
7     ${h.stylesheet_link('/css/main.css')}
8   </head>
9   <body>
10     <div id="nav" class="block">
11       <table>
12         <tr>
13           <td>
14             <h1 class="title">
15               % if c.title:
16                 ${c.title}
17               % else:
18                 BlueChips
19               % endif
20             </h1>
21           </td>
22           <td>
23             <a href="${h.url_for(controller='status', action='index', id=None)}">
24               <img src="/icons/dashboard.png" alt="">
25               <span>Dashboard</span>
26             </a>
27           </td>
28           <td>
29             <a href="${h.url_for(controller='spend', action='index', id=None)}">
30               <img src="/icons/spend.png" alt="">
31               <span>Expense</span>
32             </a>
33           </td>
34           <td>
35             <a href="${h.url_for(controller='transfer', action='index', id=None)}">
36               <img src="/icons/transfer.png" alt="">
37               <span>Transfer</span>
38             </a>
39           </td>
40           <td>
41             <a href="${h.url_for(controller='history', action='index', id=None)}">
42               <img src="/icons/history.png" alt="">
43               <span>History</span>
44             </a>
45           </td>
46         </tr>
47       </table>
48     </div>
49     % for message in h.flash.pop_messages():
50       <div class="flash">${message | n}</div>
51     % endfor
52     <div id="content">
53       ${next.body()}
54     </div>
55   </body>
56 </html>
57
58 <%def name="title()">BlueChips
59 % if c.title != '':
60   :: ${c.title}
61 % endif
62 </%def>
63
64 <%def name="formatUser(user)">
65   % if user == request.environ['user']:
66     <strong>Me</strong>
67   % else:
68     ${user.name}
69   % endif
70 </%def>
71
72 <%def name="listExpenditures(es)">
73   <table class="list">
74     <tr>
75       <th class="date">Date</th>
76       <th class="user">Spender</th>
77       <th class="description">Description</th>
78       <th class="amount">Amount</th>
79       <th class="share">My Share</th>
80       <th class="editlink"></th>
81     </tr>
82     % for e in es:
83       <%
84         if e.involves(request.environ['user']):
85           klass = 'user-involved'
86         else:
87           klass = 'user-not-involved'
88       %>
89       <tr class="${klass}">
90         <td class="date">${e.date}</td>
91         <td class="user">${formatUser(e.spender)}</td>
92         <td class="description">${e.description}</td>
93         <td class="amount">${e.amount}</td>
94         <td class="share">${e.share(request.environ['user'])}</td>
95         <td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
96       </tr>
97     % endfor
98   </table>
99 </%def>
100
101 <%def name="listTransfers(ts)">
102   <table class="list">
103     <tr>
104       <th class="date">Date</th>
105       <th class="user">From</th>
106       <th class="user">To</th>
107       <th class="description">Description</th>
108       <th class="amount">Amount</th>
109       <th class="editlink"></th>
110     </tr>
111     % for t in ts:
112       <%
113         if t.involves(request.environ['user']):
114           klass = 'user-involved'
115         else:
116           klass = 'user-not-involved'
117       %>
118       <tr class="${klass}">
119         <td class="date">${t.date}</td>
120         <td class="user">${formatUser(t.debtor)}</td>
121         <td class="user">${formatUser(t.creditor)}</td>
122         <td class="description">${t.description}</td>
123         <td class="amount">${t.amount}</td>
124         <td class="editlink">${h.link_to('Edit', h.url_for(controller='transfer', action='edit', id=t.id))}</td>
125       </tr>
126     % endfor
127   </table>
128 </%def>
129
130 <%def name="expenditureIcon()">
131 &larr;<span class="dollarsign">&rarr;
132 </%def>
133
134 <%def name="transferIcon()">
135 <span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
136 </%def>