]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
888255cbb085affec730b973cd462278eb439625
[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')}">
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')}">
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')}">
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')}">
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')}">
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">${str(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     </tr>
97     % for e in es:
98       <%
99         if e.involves(request.environ['user']):
100           klass = 'user-involved'
101         else:
102           klass = 'user-not-involved'
103       %>
104       <tr class="${klass}">
105         <td class="date">${e.date}</td>
106         <td class="user">${formatUser(e.spender)}</td>
107         <td class="description">${e.description}</td>
108         <td class="amount">${e.amount}</td>
109         <td class="share">${e.share(request.environ['user'])}</td>
110         <td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
111       </tr>
112     % endfor
113   </table>
114 </%def>
115
116 <%def name="listTransfers(ts)">
117   <table class="list">
118     <tr>
119       <th class="date">Date</th>
120       <th class="user">From</th>
121       <th class="user">To</th>
122       <th class="description">Description</th>
123       <th class="amount">Amount</th>
124       <th class="editlink"></th>
125     </tr>
126     % for t in ts:
127       <%
128         if t.involves(request.environ['user']):
129           klass = 'user-involved'
130         else:
131           klass = 'user-not-involved'
132       %>
133       <tr class="${klass}">
134         <td class="date">${t.date}</td>
135         <td class="user">${formatUser(t.debtor)}</td>
136         <td class="user">${formatUser(t.creditor)}</td>
137         <td class="description">${t.description}</td>
138         <td class="amount">${t.amount}</td>
139         <td class="editlink">${h.link_to('Edit', h.url_for(controller='transfer', action='edit', id=t.id))}</td>
140       </tr>
141     % endfor
142   </table>
143 </%def>
144
145 <%def name="expenditureIcon()">
146 &larr;<span class="dollarsign">&rarr;
147 </%def>
148
149 <%def name="transferIcon()">
150 <span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
151 </%def>