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