Add links to create new election/quick vote on the account summary screen.
[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>Your Elections:
14   <table class="voterbox" id="election">
15     <tr>
16       <% ["Name", "Description", "Details"].each do |column| -%>
17             <th><%= column %></th>
18           <% end -%>
19     </tr>
20     
21     <% @user.elections.select {|e| e.instance_of?(Election)}.each do |election| %>
22     <tr>
23           <td style="text-align: left;">
24             <%= link_to "#{election.name}", :controller => 'election', 
25                             :action => 'show', :id => election %>
26           </td>
27           <td style="text-align: left;"><%=h election.description %></td>
28           <td style="text-align: left;">
29         <strong>Start:</strong> <%=h election.startdate.strftime("%x") %><br />
30         <strong>End:</strong> <%=h election.enddate.strftime("%x") %><br />
31         <strong>Method:</strong> <%=h ELECTION_TYPES[election.election_method] %><br />
32             <strong>Open:</strong> <%= (not election.authenticated?).to_s.capitalize %>
33           </td>
34           
35     </tr>
36     <% end -%>
37   </table>
38 </p>
39 <p><%= link_to "Create a new election", :controller => 'election', :action => 'new' %>.</p>
40
41 <br />
42
43 <p>
44 Your Quickvotes:
45 <table class="voterbox">
46   <tr>
47   <% ["Name", "Description", "Start Date", "End Date", "Notices"].each do |column| %>
48         <th><%= column %></th>
49   <% end -%>
50   </tr>
51
52   <% @user.elections.select {|e| e.instance_of?(QuickVote)}.each do |quickvote|
53    %>
54   <tr>
55         <td>    
56           <% if quickvote.active == 1 %>
57             <%= link_to "#{quickvote.name}",
58                      quickaction_url( :ident => quickvote.name, 
59                                       :action => 'results' ) %>
60                 <% else %>
61                   <%=h quickvote.name %>
62                 <% end %>
63         </td>
64         <td><%=h quickvote.description %></td>
65     <td><%=h quickvote.startdate.strftime("%x") %></td>
66     <td><%=h quickvote.enddate.strftime("%x") %></td>
67     <td>
68          <% if quickvote.notices == 0 -%>
69                No
70              <% else -%>
71                Yes
72              <% end -%>
73           </td>
74   </tr>
75 <% end %>
76 </table>
77 <p><%= link_to( "Create a new QuickVote", :controller => 'quickvote', :action => 'create') %>.</p>

Benjamin Mako Hill || Want to submit a patch?