]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
Use ajax.googleapis.com for jQuery instead of hosting it locally.
[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     % if c.mobile_client:
12       <div id="mobile">
13         <a href="${h.url_for(request.url, use_non_mobile='no')}">Use mobile interface</a>
14       </div>
15     % endif
16     <div id="nav" class="block">
17       <table>
18         <tr>
19           <td>
20             <h1 class="title">
21               % if c.title:
22                 ${c.title}
23               % else:
24                 BlueChips
25               % endif
26             </h1>
27           </td>
28           <td>
29             <a href="${h.url_for(controller='status', action='index', id=None)}">
30               <img src="/icons/status.png" alt="">
31               <span>Dashboard</span>
32             </a>
33           </td>
34           <td>
35             <a href="${h.url_for(controller='spend', action='index', id=None)}">
36               <img src="/icons/spend.png" alt="">
37               <span>Expense</span>
38             </a>
39           </td>
40           <td>
41             <a href="${h.url_for(controller='transfer', action='index', id=None)}">
42               <img src="/icons/transfer.png" alt="">
43               <span>Transfer</span>
44             </a>
45           </td>
46           <td>
47             <a href="${h.url_for(controller='history', action='index', id=None)}">
48               <img src="/icons/history.png" alt="">
49               <span>History</span>
50             </a>
51           </td>
52           <td>
53             <a href="${h.url_for(controller='user', action='index', id=None)}">
54               <img src="/icons/user.png" alt="">
55               <span>User</span>
56             </a>
57           </td>
58         </tr>
59       </table>
60     </div>
61     % for message in h.flash.pop_messages():
62       <div class="flash">${message | n}</div>
63     % endfor
64     <div id="content">
65       ${next.body()}
66     </div>
67     ${h.javascript_link('//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js')}
68     ${h.javascript_link('/js/jquery.date_input.js')}
69     ${h.javascript_link('/js/admin.js')}
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>