]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/mobile/base.mako
We have pie charts.
[bluechips.git] / bluechips / templates / mobile / 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     <link media="only screen and (max-device-width: 480px)" href="${request.script_name}/css/mobile.css" type="text/css" rel="stylesheet" />
9     <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable=no" />
10     <link rel="apple-touch-icon" href="${request.script_name}/icons/apple-touch.png" />
11     <link rel="apple-touch-startup-image" href="${request.script_name}/icons/apple-touch-startup.png" />
12     <meta name="apple-mobile-web-app-capable" content="yes" />
13     <meta name="apple-mobile-web-app-status-bar-style" content="black" />
14     ${h.javascript_link('//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js')}
15     ${h.javascript_link('%s/js/mobile.js' % request.script_name)}
16   </head>
17   <body>
18     % for message in h.flash.pop_messages():
19       <div class="flash">${message | n}</div>
20     % endfor
21     ${next.body()}
22     <div id="non-mobile">
23       <a href="${h.url_for(request.url, use_non_mobile='yes')}">Use non mobile interface</a>
24     </div>
25   </body>
26 </html>
27
28 <%!
29   from datetime import date
30 %>
31
32 <%def name="title()">BlueChips
33 % if c.title != '':
34   :: ${c.title}
35 % endif
36 </%def>
37
38 <%def name="formatUser(user)">
39   % if user == request.environ['user']:
40     <strong>Me</strong>
41   % else:
42     ${user.name}
43   % endif
44 </%def>
45
46 <%def name="tabs(selected)">
47   <div id="tabs">
48     % for name in ('status', 'spend', 'transfer'):
49       <%
50         if name == selected:
51           klass = 'selected'
52         else:
53           klass = 'unselected'
54       %>
55       <a id="${name}" class="${klass}" href="${h.url_for(controller=name, action='index')}">
56         <img src="${request.script_name}/icons/${name}.png" alt="">
57         <span>${name.capitalize()}</span>
58       </a>
59     % endfor
60   </div>
61 </%def>
62
63 <%def name="spendForm()">
64   <div id="tab-spend" class="tab">
65     <%
66       if c.id != '':
67           id = c.id
68       else:
69           id = None
70     %>
71     <form action="${h.url_for(controller='spend', action='update', id=id)}" method="post">
72       ${h.auth_token_hidden_field()}
73       <table class="form">
74         <tr>
75           <th><label for="spender_id">Spender</label></th>
76           <td>${h.select('spender_id', [h.grab(c.expenditure, 'spender_id')], c.users)}</td>
77         </tr>
78         <tr>
79           <th><label for="amount">Amount</label></th>
80           <td>${h.currency('amount', h.grab(c.expenditure, 'amount'), size=8)}</td>
81         </tr>
82         <tr>
83           <th><label for="date">Date</label></th>
84           <td>${h.text('date', h.grab(c.expenditure, 'date').strftime('%m/%d/%Y'), size=16)}</td>
85         </tr>
86         <tr>
87           <th><label for="description">Description</label></th>
88           <td>${h.text('description', h.grab(c.expenditure, 'description'))}</td>
89         </tr>
90         <tr>
91           <th><label for="tags">Tags</label></th>
92           <td>${h.text('tags', h.grab(c, 'tags'))}</td>
93         </tr>
94       </table>
95
96       <p>Change how an expenditure is split up.</p>
97
98       <table class="form">
99         % for ii, user_row in enumerate(c.users):
100           <%
101             user_id, user = user_row
102           %>
103           <tr>
104             <th><label for="shares-${ii}amount">${user.name}</label></th>
105             <td>
106               ${h.text('shares-%d.amount' % ii, 1 if user.resident else None)}
107               ${h.hidden('shares-%d.user_id' % ii, user.id)}
108             </td>
109           </tr>
110         % endfor
111         <tr>
112           <td colspan="2">
113             ${h.submit(None, 'Submit', class_="submitbutton")}
114           </td>
115         </tr>
116       </table>
117     </form>
118   </div>
119 </%def>
120
121 <%def name="transferForm()">
122   <%
123     if c.id != '':
124         id = c.id
125     else:
126         id = None
127   %>
128   <div id="tab-transfer" class="tab">
129     <form action="${h.url_for(controller='transfer', action='update', id=id)}" method="post">
130       ${h.auth_token_hidden_field()}
131       <table class="form">
132         <tr>
133           <th><label for="debtor_id">From</label></th>
134           <td>${h.select('debtor_id', [h.grab(c.transfer, 'debtor_id')], c.users)}</td>
135         </tr>
136         <tr>
137           <th><label for="creditor_id">To</label></th>
138           <td>${h.select('creditor_id', [h.grab(c.transfer, 'creditor_id')], c.users)}</td>
139         </tr>
140         <tr>
141           <th><label for="amount">Amount</label></th>
142           <td>${h.currency('amount', h.grab(c.transfer, 'amount'), size=8)}</td>
143         </tr>
144         <tr>
145           <th><label for="date">Date</label></th>
146           <td>${h.text('date', h.grab(c.transfer, 'date').strftime('%m/%d/%Y'), size=16)}</td>
147         </tr>
148         <tr>
149           <th><label for="description">Description</label></th>
150           <td>${h.text('description', h.grab(c.transfer, 'description'))}</td>
151         </tr>
152         <tr>
153           <td colspan="2">
154             <input type="submit" value="Submit" />
155           </td>
156         </tr>
157       </table>
158     </form>
159   </div>
160 </%def>