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