ff116f47570a1a8f1cb1bab7e12b393a1b2744e8
[selectricity-live] / app / views / election / show.rhtml
1 <div id="title-header">
2   <span class="header">Election Overview</span>
3   <span class="subheader"></span>
4 </div>
5 <% if @election.enddate < Time.now %>
6 <div id="status">Election is finished. <%= link_to "View results",
7         :controller => 'voter', :action => 'index', 
8         :election_id => @election.id %>.</div>
9
10 <% elsif (@election.active? && @election.early_results? ) %>
11   <div id="status">The creator of this election has decided that the results
12         should be viewable while the election is in progress.
13         <%if @election.voters.empty? %>
14         However, no one has voted yet.
15         <% else %>
16         <%= link_to "View results", :controller => 'voter', :action => 'results', 
17                 :id => "open" %>.
18     <% end %>
19   </div>
20 <% elsif @election.active? %>
21   <div id="status">Vote is in currently in progress. Return to
22         this page for results on <%= @election.enddate %>.</div>
23   
24 <% else %>
25   <p style="text-align: right;">
26     <%= link_to "Edit General Information",
27                 :action => 'edit_general_information', :id => @election.id %>
28   </p>
29 <% end %>
30
31 <p><strong>Summary</strong></p>
32
33 <blockquote>
34 <%= h(@election.name) %>
35 </blockquote>
36
37 <p><strong>Description</strong></p>
38
39 <blockquote>
40 <%= h(@election.description) %>
41 </blockquote>
42
43 <p><strong>Additional Information</strong></p>
44
45 <ul> <li>Elections will end at <strong><%= @election.enddate
46 %></strong>.</li> <li>Elections results <strong><% if
47 @election.early_results %>will be<% else %>will not be<% end
48 %></strong> visible while election is in progress.</li>
49
50 <% if @election.embeddable %>
51 <li>Elections <strong>will be</strong> embeddable.</li>
52 <% end %>
53
54 <% if @election.kiosk %>
55 <li>Selectricity's kiosk mode <strong>will be</strong> available.</li>
56 <% end %>
57
58 <% if @election.verifiable%>
59 <li>Voters <strong>will be</strong> given tokens to verify their votes.</li>
60 <% else %>
61 <li>Elections <strong>will not be</strong> voter verifiable.</li>
62 <% end %>
63
64 </ul>
65
66 <% if @election.active? and not @election.authenticated? %>
67 <p><strong>Link to election:</strong></p>
68 <ul>
69 <li><%= (link_to ("Vote in election", 
70           :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
71      (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s) %>)</li>
72
73 <% if @election.kiosk %>
74 <li><%= (link_to ("Kiosk mode",
75           :controller => 'voter', :action => 'index', :election_id => @election.id, :kiosk => true)).to_s %>
76      (<%= votepassword_url(:urlpassword => "open." + @election.id.to_s, :kiosk => true) %>)</li>
77   <% end %>
78 </ul>
79 <% end -%>
80
81 <div class="normal-header">
82   <span class="header">Candidates</span>
83   <span class="subheader"></span>
84 </div>
85
86
87 <% if not (@election.active? or @election.done?) %>
88   <p style="text-align: right;">
89     <%= link_to "Edit Candidates",
90                :action => 'edit_candidates', :id => @election.id %></p>
91 <% end %>
92
93
94 <% if @election.candidates.empty? %>
95   <p><em>There are currently no candidates registered.</em>
96      <%= link_to "Add some!", :action => 'edit_candidates', :id => @election.id %>
97   </p>
98 <% else %>
99   <%= render :partial => 'candidate_list' %>
100 <% end %>
101
102 <div class="normal-header">
103   <span class="header">Voters</span>
104   <span class="subheader"></span>
105 </div>
106
107 <% if not (@election.active?  or @election.done?) %>
108 <p style="text-align: right;">
109   <%= link_to "Change Voters/Options",
110               :action => 'edit_voters', :id => @election.id %></p>
111 <% end %>
112
113 <% if not @election.authenticated? %>
114   <p><em>This election is open the public.</em></p>
115 <% elsif @election.voters.empty? %>
116   <p><em>There are currently no voters registered. </em>
117      <%= link_to "Add some!", :action => 'edit_voters',
118                  :id => @election.id %></p>
119 <% else %>
120   <%= render :partial => 'voter_list' %>
121   <p><em><%= link_to "Add or remove voters.", :action => 'edit_voters',
122               :id => @election.id unless @election.active? or @election.done? %>
123   </em></p>
124 <% end %>
125
126 <% if not (@election.active? or @election.done?)  %>
127
128 <div class="normal-header">
129   <span class="header">Start Election</span>
130   <span class="subheader"></span>
131 </div>
132
133   <% if @election.start_blockers.length > 0 %>
134     <p>Your vote cannot be started for the following reasons:</p>
135     <ul>
136     <% for reason in @election.start_blockers %>
137     <li><%= reason %></li>
138     <% end %>
139     </ul>
140   <% else %>
141     <p>Please check everything carefully on this page before starting this
142     vote. Once you begin the vote, you will <em>not</em> be able to add or
143     change candidates, modify the voting lists, or change the end
144     time.</p>
145
146     <p>When you begin the vote, the following will happen:</p>
147
148     <ul>
149     <li>The vote will be "frozen" so that further edits to the
150         candidate list and voting list cannot occur.</li>
151     <% if @election.authenticated? %>
152     <li>All voters will be emailed notifying them that the vote has
153         begun and of their unique login token.</li>
154     <% end %>
155     </ul>
156
157     <%= button_to 'Start Election!', :action => 'start_election', :id => @election.id %>
158   <% end %>
159
160 <% elsif @election.embeddable? %>
161
162 <div class="normal-header">
163   <span class="header">Embedding</span>
164   <span class="subheader"></span>
165 </div>
166
167
168 <p>To embed your election, copy and paste the following code into your
169 homepage:</p>
170
171 <pre><%= h("<iframe src='") + votepassword_url(:urlpassword => "open." + @election.id.to_s, :embed => "true") + h("' width='330px' height='#{(@election.candidates.length+2)*53}px'>" ) %>
172 <%= h("</iframe>") %></pre>
173
174 <% end %>

Benjamin Mako Hill || Want to submit a patch?