User summary method is now more secure. Email change method prtects account SQL injec...
[selectricity] / app / views / account / summary.rhtml
1 <div id="title-header">
2   <span class="header">Account Summary</span>
3   <span class="subheader"></span>
4 </div>
5
6 <h3>This is your account summary profile, <%=h @user.login.capitalize %></h3>
7
8 <p>
9 E-mail: <%=h @user.email %><br />
10 Member since: <%=h @user.created_at.strftime("%x") %>
11 </p>
12
13 <p>
14         <%= link_to "Update Email Address", :action => 'change_contact',
15                                                                           :id => @user.id %>
16 </p>
17
18
19 <p>Your Elections:
20   <table class="voterbox" id="election">
21     <tr>
22       <% ["Name", "Description", "Details"].each do |column| -%>
23             <th><%= column %></th>
24           <% end -%>
25     </tr>
26     
27     <% @user.elections.select {|e| e.instance_of?(Election)}.each do |election| %>
28     <tr>
29           <td style="text-align: left;">
30             <%= link_to "#{election.name}", :controller => 'election', 
31                             :action => 'show', :id => election %>
32           </td>
33           <td style="text-align: left;"><%=h election.description %></td>
34           <td style="text-align: left;">
35         <strong>Start:</strong> <%=h election.startdate.strftime("%x") %><br />
36         <strong>End:</strong> <%=h election.enddate.strftime("%x") %><br />
37         <strong>Method:</strong> <%=h ELECTION_TYPES[election.election_method] %><br />
38             <strong>Open:</strong> <%= (not election.authenticated?).to_s.capitalize %>
39           </td>
40           
41     </tr>
42     <% end -%>
43   </table>
44 </p>
45
46 <br />
47
48 <p>
49 Your Quickvotes:
50 <table class="voterbox">
51   <tr>
52   <% ["Name", "Description", "Start Date", "End Date", "Notices"].each do |column| %>
53         <th><%= column %></th>
54   <% end -%>
55   </tr>
56
57   <% @user.elections.select {|e| e.instance_of?(QuickVote)}.each do |quickvote|
58    %>
59   <tr>
60         <td>    
61           <% if quickvote.active == 1 %>
62             <%= link_to "#{quickvote.name}",
63                      quickaction_url( :ident => quickvote.name, 
64                                       :action => 'results' ) %>
65                 <% else %>
66                   <%=h quickvote.name %>
67                 <% end %>
68         </td>
69         <td><%=h quickvote.description %></td>
70     <td><%=h quickvote.startdate.strftime("%x") %></td>
71     <td><%=h quickvote.enddate.strftime("%x") %></td>
72     <td>
73          <% if quickvote.notices == 0 -%>
74                No
75              <% else -%>
76                Yes
77              <% end -%>
78           </td>
79   </tr>
80 <% end %>
81 </table>

Benjamin Mako Hill || Want to submit a patch?