added first stab at a kiosk mode
[selectricity-live] / app / views / election / show.rhtml
index 87529d18c1c41633fcff130b10e5b83c0b881534..ff116f47570a1a8f1cb1bab7e12b393a1b2744e8 100644 (file)
@@ -2,13 +2,25 @@
   <span class="header">Election Overview</span>
   <span class="subheader"></span>
 </div>
-
-<% if @election.active? %>
+<% if @election.enddate < Time.now %>
+<div id="status">Election is finished. <%= link_to "View results",
+       :controller => 'voter', :action => 'index', 
+       :election_id => @election.id %>.</div>
+
+<% elsif (@election.active? && @election.early_results? ) %>
+  <div id="status">The creator of this election has decided that the results
+       should be viewable while the election is in progress.
+       <%if @election.voters.empty? %>
+       However, no one has voted yet.
+       <% else %>
+       <%= link_to "View results", :controller => 'voter', :action => 'results', 
+               :id => "open" %>.
+    <% end %>
+  </div>
+<% elsif @election.active? %>
   <div id="status">Vote is in currently in progress. Return to
         this page for results on <%= @election.enddate %>.</div>
-<% elsif @election.done? %>
-  <div id="status">Election is finished. <%= link_to "View results",
-  :action => 'results', :id => @election.id %>.</div>
+  
 <% else %>
   <p style="text-align: right;">
     <%= link_to "Edit General Information",
 <ul> <li>Elections will end at <strong><%= @election.enddate
 %></strong>.</li> <li>Elections results <strong><% if
 @election.early_results %>will be<% else %>will not be<% end
-%></strong> will be visible while election is in progress.</li>
+%></strong> visible while election is in progress.</li>
 
 <% if @election.embeddable %>
 <li>Elections <strong>will be</strong> embeddable.</li>
 <% end %>
 
+<% if @election.kiosk %>
+<li>Selectricity's kiosk mode <strong>will be</strong> available.</li>
+<% end %>
+
+<% if @election.verifiable%>
+<li>Voters <strong>will be</strong> given tokens to verify their votes.</li>
+<% else %>
+<li>Elections <strong>will not be</strong> voter verifiable.</li>
+<% end %>
+
 </ul>
 
+<% if @election.active? and not @election.authenticated? %>
+<p><strong>Link to election:</strong></p>
+<ul>
+<li><%= (link_to ("Vote in election", 
+          :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
+     (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s) %>)</li>
+
+<% if @election.kiosk %>
+<li><%= (link_to ("Kiosk mode",
+          :controller => 'voter', :action => 'index', :election_id => @election.id, :kiosk => true)).to_s %>
+     (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s, :kiosk => true) %>)</li>
+  <% end %>
+</ul>
+<% end -%>
 
 <div class="normal-header">
   <span class="header">Candidates</span>
 <p>To embed your election, copy and paste the following code into your
 homepage:</p>
 
-<blockquote>
-<tt><pre><%= h("<iframe src='") + votepassword_url(:urlpassword => "open." + @election.id.to_s) + h("'") + "<br />" + h(" width='330px' height='370px'></iframe>") %></pre></tt>
-</blockquote>
+<pre><%= h("<iframe src='") + votepassword_url(:urlpassword => "open." + @election.id.to_s, :embed => "true") + h("' width='330px' height='#{(@election.candidates.length+2)*53}px'>" ) %>
+<%= h("</iframe>") %></pre>
 
 <% end %>

Benjamin Mako Hill || Want to submit a patch?