]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
renamed dashboard.png to status.png for consistency
[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/status.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           <td>
48             <a href="${h.url_for(controller='user', action='index', id=None)}">
49               <img src="/icons/user.png" alt="">
50               <span>User</span>
51             </a>
52           </td>
53         </tr>
54       </table>
55     </div>
56     % for message in h.flash.pop_messages():
57       <div class="flash">${message | n}</div>
58     % endfor
59     <div id="content">
60       ${next.body()}
61     </div>
62     ${h.javascript_link('/js/jquery-1.3.2.js')}
63     ${h.javascript_link('/js/jquery.date_input.js')}
64     ${h.javascript_link('/js/admin.js')}
65   </body>
66 </html>
67
68 <%def name="title()">BlueChips
69 % if c.title != '':
70   :: ${c.title}
71 % endif
72 </%def>
73
74 <%def name="formatUser(user)">
75   % if user == request.environ['user']:
76     <strong>Me</strong>
77   % else:
78     ${user.name}
79   % endif
80 </%def>
81
82 <%def name="listExpenditures(es)">
83   <table class="list">
84     <tr>
85       <th class="date">Date</th>
86       <th class="user">Spender</th>
87       <th class="description">Description</th>
88       <th class="amount">Amount</th>
89       <th class="share">My Share</th>
90       <th class="editlink"></th>
91       <th class="deletelink"></th>
92     </tr>
93     % for e in es:
94       <%
95         if e.involves(request.environ['user']):
96           klass = 'user-involved'
97         else:
98           klass = 'user-not-involved'
99       %>
100       <tr class="${klass}">
101         <td class="date">${e.date}</td>
102         <td class="user">${formatUser(e.spender)}</td>
103         <td class="description">${e.description}</td>
104         <td class="amount">${e.amount}</td>
105         <td class="share">${e.share(request.environ['user'])}</td>
106         <td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
107         <td class="deletelink">${h.link_to('Delete', h.url_for(controller='spend', action='delete', id=e.id))}</td>
108       </tr>
109     % endfor
110   </table>
111 </%def>
112
113 <%def name="listTransfers(ts)">
114   <table class="list">
115     <tr>
116       <th class="date">Date</th>
117       <th class="user">From</th>
118       <th class="user">To</th>
119       <th class="description">Description</th>
120       <th class="amount">Amount</th>
121       <th class="editlink"></th>
122       <th class="deletelink"></th>
123     </tr>
124     % for t in ts:
125       <%
126         if t.involves(request.environ['user']):
127           klass = 'user-involved'
128         else:
129           klass = 'user-not-involved'
130       %>
131       <tr class="${klass}">
132         <td class="date">${t.date}</td>
133         <td class="user">${formatUser(t.debtor)}</td>
134         <td class="user">${formatUser(t.creditor)}</td>
135         <td class="description">${t.description}</td>
136         <td class="amount">${t.amount}</td>
137         <td class="editlink">${h.link_to('Edit', h.url_for(controller='transfer', action='edit', id=t.id))}</td>
138         <td class="deletelink">${h.link_to('Delete', h.url_for(controller='transfer', action='delete', id=t.id))}</td>
139       </tr>
140     % endfor
141   </table>
142 </%def>
143
144 <%def name="expenditureIcon()">
145 &larr;<span class="dollarsign">&rarr;
146 </%def>
147
148 <%def name="transferIcon()">
149 <span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
150 </%def>