]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/base.mako
Added UI for working with tags
[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, total=None, share=None)">
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     % if total is not None and share is not None:
114       <tr class="user-involved">
115         <td class="total" colspan=3></td>
116         <td class="total">${total}</td>
117         <td class="total">${share}</td>
118         <td class="total"></td>
119       </tr>
120
121     % endif
122   </table>
123 </%def>
124
125 <%def name="listTransfers(ts)">
126   <table class="list">
127     <tr>
128       <th class="date">Date</th>
129       <th class="user">From</th>
130       <th class="user">To</th>
131       <th class="description">Description</th>
132       <th class="amount">Amount</th>
133       <th class="editlink"></th>
134     </tr>
135     % for t in ts:
136       <%
137         if t.involves(request.environ['user']):
138           klass = 'user-involved'
139         else:
140           klass = 'user-not-involved'
141       %>
142       <tr class="${klass}">
143         <td class="date">${t.date}</td>
144         <td class="user">${formatUser(t.debtor)}</td>
145         <td class="user">${formatUser(t.creditor)}</td>
146         <td class="description">${t.description}</td>
147         <td class="amount">${t.amount}</td>
148         <td class="editlink">${h.link_to('Edit', h.url_for(controller='transfer', action='edit', id=t.id))}</td>
149       </tr>
150     % endfor
151   </table>
152 </%def>
153
154 <%def name="listTags()">
155 <%
156 x = ',\n'.join([h.link_to(tag.name, h.url_for(controller='history', action='tag', id=tag.id)) for tag in c.tags])
157 %>
158 ${x|n}
159 </%def>
160
161
162 <%def name="expenditureIcon()">
163 &larr;<span class="dollarsign">&rarr;
164 </%def>
165
166 <%def name="transferIcon()">
167 <span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
168 </%def>