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