]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/spend/index.mako
added XSRF protection to all forms and associated tests
[bluechips.git] / bluechips / templates / spend / index.mako
1 <%inherit file="/base.mako"/>
2
3 <%!
4     from decimal import Decimal
5 %>
6
7 <form action="${h.url_for(controller='spend', action='update', id=c.expenditure.id)}" method="post">
8   ${h.auth_token_hidden_field()}
9   <table class="form">
10     <tr>
11       <th><label for="spender_id">Spender</label></th>
12       <td>${h.select('spender_id', c.expenditure.spender_id, c.users)}</td>
13     </tr>
14     <tr>
15       <th><label for="amount">Amount</label></th>
16       <td>${h.currency('amount', c.expenditure.amount, size=8)}</td>
17     </tr>
18     <tr>
19       <th><label for="date">Date</label></th>
20       <td>${h.text('date', c.expenditure.date.strftime('%m/%d/%Y'), size=16, class_='datepicker')}</td>
21     </tr>
22     <tr>
23       <th><label for="description">Description</label></th>
24       <td>${h.text('description', c.expenditure.description, size=64)}</td>
25     </tr>
26   </table>
27
28   <p>Change how an expenditure is split up. Enter a percentage, or something like a percentage, for each user. They don't have to add to 100.</p>
29
30   <table class="form">
31     % for ii, user_row in enumerate(c.users):
32       <%
33         user_id, user = user_row
34         percent = c.values['shares-%d.amount' % ii]
35       %>
36       <tr>
37         <th><label for="shares-${ii}amount">${user.name}</label></th>
38         <td>
39           ${h.text('shares-%d.amount' % ii, percent)}
40           ${h.hidden('shares-%d.user_id' % ii, user.id)}
41         </td>
42       </tr>
43     % endfor
44     <tr>
45       <td colspan="2">
46         ${h.submit(None, 'Submit', class_="submitbutton")}
47       </td>
48     </tr>
49   </table>
50 </form>