List open polls on polls page
authorAdam Chlipala <adamc@hcoop.net>
Thu, 24 Jan 2008 23:09:10 +0000 (23:09 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Thu, 24 Jan 2008 23:09:10 +0000 (23:09 +0000)
poll.mlt

index 505044f..4b7d968 100644 (file)
--- a/poll.mlt
+++ b/poll.mlt
@@ -313,9 +313,21 @@ end %>
 
 <% end %>
 <%     | NONE =>
-if showNormal then %>
+if showNormal then
 
-<a href="poll?cmd=list">Show all polls</a><br>
+val polls = Poll.listCurrentPolls ();
+switch polls of
+       _::_ => %>
+<h3><a href="poll">Current polls</a></h3>
+
+<% foreach pol in polls do %>
+<li> <a href="poll?id=<% #id pol %>"><% Web.html (#title pol) %></a>
+<% if Poll.takingVotes pol then %><a href="poll?vote=<% #id pol %>">[VOTE]</a><% end %>
+(<% Web.html (#starts pol) %> to <% Web.html (#ends pol) %>)</li>
+<% end
+end %>
+
+<p><a href="poll?cmd=list">Show all polls</a></p>
 
 <h3>Create a poll</h3>