added first full working version of embeddable elections
[selectricity-live] / app / views / election / show.rhtml
index 3e636281fcccbbb099d294ea624d0e84d7aded53..87529d18c1c41633fcff130b10e5b83c0b881534 100644 (file)
@@ -9,6 +9,11 @@
 <% 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",
+                :action => 'edit_general_information', :id => @election.id %>
+  </p>
 <% end %>
 
 <p><strong>Summary</strong></p>
 <%= h(@election.description) %>
 </blockquote>
 
-<p><strong>End Date</strong></p>
+<p><strong>Additional Information</strong></p>
 
-<blockquote>
-<%= @election.enddate %>
-</blockquote>
+<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>
 
-<% unless @election.active %>
-<p><%= link_to "Edit overview.", :action => 'edit', :id => @election.id %></p>
+<% if @election.embeddable %>
+<li>Elections <strong>will be</strong> embeddable.</li>
 <% end %>
 
+</ul>
+
+
 <div class="normal-header">
   <span class="header">Candidates</span>
   <span class="subheader"></span>
 </div>
 
-<% unless @election.candidates.empty? %>
-  <%= render :partial => 'candidate_list' %>
-  <% unless @election.active %>
-  <p><%= link_to "Add, remove, or edit candidates.", :action => 'edit_candidates', :id => @election.id %></p>
-  <% end %>
-<% else %>
-  <p><em>There are currently no candidates registered.  <%= link_to "Add some!", :action => 'edit_candidates', :id => @election.id unless @election.active %></em></p>
 
+<% if not (@election.active? or @election.done?) %>
+  <p style="text-align: right;">
+    <%= link_to "Edit Candidates",
+               :action => 'edit_candidates', :id => @election.id %></p>
+<% end %>
+
+
+<% if @election.candidates.empty? %>
+  <p><em>There are currently no candidates registered.</em>
+     <%= link_to "Add some!", :action => 'edit_candidates', :id => @election.id %>
+  </p>
+<% else %>
+  <%= render :partial => 'candidate_list' %>
 <% end %>
 
 <div class="normal-header">
   <span class="subheader"></span>
 </div>
 
-<% unless @election.voters.empty? %>
-  <%= render :partial => 'voter_list' %>
-  <%= link_to "Add or remove voters.", :action => 'edit_voters', :id => @election.id unless @election.active %></em></p>
+<% if not (@election.active?  or @election.done?) %>
+<p style="text-align: right;">
+  <%= link_to "Change Voters/Options",
+              :action => 'edit_voters', :id => @election.id %></p>
+<% end %>
+
+<% if not @election.authenticated? %>
+  <p><em>This election is open the public.</em></p>
+<% elsif @election.voters.empty? %>
+  <p><em>There are currently no voters registered. </em>
+     <%= link_to "Add some!", :action => 'edit_voters',
+                 :id => @election.id %></p>
 <% else %>
-  <p><em>There are currently no voters registered.  <%= link_to "Add some!", :action => 'edit_voters', :id => @election.id unless @election.active %></em></p>
+  <%= render :partial => 'voter_list' %>
+  <p><em><%= link_to "Add or remove voters.", :action => 'edit_voters',
+              :id => @election.id unless @election.active? or @election.done? %>
+  </em></p>
 <% end %>
 
-<% unless @election.active? %>
+<% if not (@election.active? or @election.done?)  %>
 
 <div class="normal-header">
   <span class="header">Start Election</span>
     <ul>
     <li>The vote will be "frozen" so that further edits to the
         candidate list and voting list cannot occur.</li>
+    <% if @election.authenticated? %>
     <li>All voters will be emailed notifying them that the vote has
         begun and of their unique login token.</li>
+    <% end %>
     </ul>
 
     <%= button_to 'Start Election!', :action => 'start_election', :id => @election.id %>
   <% end %>
 
+<% elsif @election.embeddable? %>
+
+<div class="normal-header">
+  <span class="header">Embedding</span>
+  <span class="subheader"></span>
+</div>
+
+
+<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>
+
 <% end %>

Benjamin Mako Hill || Want to submit a patch?