]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
Move common title generating code into base template
[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     <h1>${self.title()}</h1>
11     <% messages = h.flash.pop_messages() %>
12     % if messages:
13     <ul id="flash-messages">
14     % for message in messages:
15         <li>${message}</li>
16     % endfor
17     </ul>
18     % endif
19     <div id="nav">
20         <ul>
21             <li>${h.link_to('Dashboard', h.url_for(controller='status',
22                                                    action='index',
23                                                    id=None))}</li>
24             <li>${h.link_to('Expense', h.url_for(controller='spend',
25                                                  action='index',
26                                                  id=None))}</li>
27             <li>${h.link_to('Transfer', h.url_for(controller='transfer',
28                                                   action='index',
29                                                   id=None))}</li>
30             <li>${h.link_to('History', h.url_for(controller='history',
31                                                  action='index',
32                                                  id=None))}</li>
33         </ul>
34     </div>
35     <div id="content">
36       ${next.body()}
37     </div>
38   </body>
39 </html>
40
41 <%def name="title()">BlueChips
42 % if c.title != '':
43   :: ${c.title}
44 % endif
45 </%def>
46
47 <%def name="listExpenditures(es)">
48 <table>
49     <tr>
50         <th>Date</th>
51         <th>Spender</th>
52         <th>Description</th>
53         <th>Amount</th>
54         <th></th>
55     </tr>
56     % for e in es:
57     <tr>
58         <td>${e.date}</td>
59         <td>${e.spender.name}</td>
60         <td>${e.description}</td>
61         <td>${e.amount}</td>
62         <td>${h.link_to('Edit', h.url_for(controller='spend', 
63                                           action='edit',
64                                           id=e.id))}</td>
65     </tr>
66     % endfor
67 </table>
68 </%def>
69
70 <%def name="listTransfers(ts)">
71 <table>
72     <tr>
73         <th>Date</th>
74         <th>From</th>
75         <th>To</th>
76         <th>Description</th>
77         <th>Amount</th>
78         <th></th>
79     </tr>
80     % for t in ts:
81     <tr>
82         <td>${t.date}</td>
83         <td>${t.debtor.name}</td>
84         <td>${t.creditor.name}</td>
85         <td>${t.description}</td>
86         <td>${t.amount}</td>
87         <td>${h.link_to('Edit', h.url_for(controller='transfer', 
88                                           action='edit',
89                                           id=t.id))}</td>
90     </tr>
91     % endfor
92 </table>
93 </%def>