Created a user "summary/profile page". Also corected several minor typos on election...
[selectricity] / app / views / account / summary.rhtml
diff --git a/app/views/account/summary.rhtml b/app/views/account/summary.rhtml
new file mode 100644 (file)
index 0000000..2f24e28
--- /dev/null
@@ -0,0 +1,84 @@
+<h2>This is your user summary profile, <%=h @user.login.capitalize %></h2>
+
+<p>
+E-mail: <%=h @user.email %><br />
+Member since: <%=h @user.created_at.strftime("%x") %>
+</p>
+
+<p>Your Elections:
+  <table class="voterbox">
+    <tr>
+         <% Election.content_columns.each do |column| -%>
+         <% next if column.name.eql?("viewable") || column.name.eql?("quickuser")\
+         || column.name.eql?("active") %>
+           <th><%= column.human_name %></th>
+         <% end -%>
+    </tr>
+    
+    <% @user.elections.select {|e| e.instance_of?(Election)}.each do |election| %>
+    <tr>
+         <td>
+       <% if election.active == 1 -%>
+           <%= link_to "#{election.name}", :controller => 'election', 
+                           :action => 'show', :id => election %>
+               <% else -%>
+                 <%=h election.name %>
+               <% end -%>
+         </td>
+         <td><%=h election.description %></td>
+         <td>
+         <% if election.anonymous == 0 -%>
+              No
+            <% else -%>
+              Yes
+            <% end -%>
+         </td>
+         <td><%=h election.startdate.strftime("%x") %></td>
+      <td><%=h election.enddate.strftime("%x") %></td>
+      <td>
+         <% if election.notices == 0 -%>
+              No
+            <% else -%>
+              Yes
+            <% end -%>
+         </td>   
+         <td><%=h election.election_method %></td>
+    </tr>
+    <% end -%>
+  </table>
+</p>
+
+<p>
+Your Quickvotes:
+<table class="voterbox">
+  <tr>
+  <% ["Name", "Description", "Start Date", "End Date", "Notices"].each do |column| %>
+       <th><%= column %></th>
+  <% end -%>
+  </tr>
+
+  <% @user.elections.select {|e| e.instance_of?(QuickVote)}.each do |quickvote|
+   %>
+  <tr>
+       <td>    
+         <% if quickvote.active == 1 %>
+           <%= link_to "#{quickvote.name}",
+                    quickaction_url( :ident => quickvote.name, 
+                                     :action => 'results' ) %>
+               <% else %>
+                 <%=h quickvote.name %>
+               <% end %>
+       </td>
+       <td><%=h quickvote.description %></td>
+    <td><%=h quickvote.startdate.strftime("%x") %></td>
+    <td><%=h quickvote.enddate.strftime("%x") %></td>
+    <td>
+         <% if quickvote.notices == 0 -%>
+              No
+            <% else -%>
+              Yes
+            <% end -%>
+         </td>
+  </tr>
+<% end %>
+</table>

Benjamin Mako Hill || Want to submit a patch?