04c71a62269e9c451b15f8fc24f99a25e0d3bb4e
[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
6 <% if @election.done? %>
7 <div id="status">Election is finished. <%= link_to "View results",
8   :action => 'detailed_results', :id => @election.id %>.</div>
9
10 <% elsif (@election.active? && @election.viewable?) %>
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", :action => 'detailed_results', 
17                 :id => @election.id %>.
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> will be 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 </ul>
55
56 <% if @election.active? and not @election.authenticated? %>
57 <p><strong>Link</strong></p>
58 <%= (link_to ("Go Vote!", 
59             :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
60 <% end -%>
61
62 <div class="normal-header">
63   <span class="header">Candidates</span>
64   <span class="subheader"></span>
65 </div>
66
67
68 <% if not (@election.active? or @election.done?) %>
69   <p style="text-align: right;">
70     <%= link_to "Edit Candidates",
71                :action => 'edit_candidates', :id => @election.id %></p>
72 <% end %>
73
74
75 <% if @election.candidates.empty? %>
76   <p><em>There are currently no candidates registered.</em>
77      <%= link_to "Add some!", :action => 'edit_candidates', :id => @election.id %>
78   </p>
79 <% else %>
80   <%= render :partial => 'candidate_list' %>
81 <% end %>
82
83 <div class="normal-header">
84   <span class="header">Voters</span>
85   <span class="subheader"></span>
86 </div>
87
88 <% if not (@election.active?  or @election.done?) %>
89 <p style="text-align: right;">
90   <%= link_to "Change Voters/Options",
91               :action => 'edit_voters', :id => @election.id %></p>
92 <% end %>
93
94 <% if not @election.authenticated? %>
95   <p><em>This election is open the public.</em></p>
96 <% elsif @election.voters.empty? %>
97   <p><em>There are currently no voters registered. </em>
98      <%= link_to "Add some!", :action => 'edit_voters',
99                  :id => @election.id %></p>
100 <% else %>
101   <%= render :partial => 'voter_list' %>
102   <p><em><%= link_to "Add or remove voters.", :action => 'edit_voters',
103               :id => @election.id unless @election.active? or @election.done? %>
104   </em></p>
105 <% end %>
106
107 <% if not (@election.active? or @election.done?)  %>
108
109 <div class="normal-header">
110   <span class="header">Start Election</span>
111   <span class="subheader"></span>
112 </div>
113
114   <% if @election.start_blockers.length > 0 %>
115     <p>Your vote cannot be started for the following reasons:</p>
116     <ul>
117     <% for reason in @election.start_blockers %>
118     <li><%= reason %></li>
119     <% end %>
120     </ul>
121   <% else %>
122     <p>Please check everything carefully on this page before starting this
123     vote. Once you begin the vote, you will <em>not</em> be able to add or
124     change candidates, modify the voting lists, or change the end
125     time.</p>
126
127     <p>When you begin the vote, the following will happen:</p>
128
129     <ul>
130     <li>The vote will be "frozen" so that further edits to the
131         candidate list and voting list cannot occur.</li>
132     <% if @election.authenticated? %>
133     <li>All voters will be emailed notifying them that the vote has
134         begun and of their unique login token.</li>
135     <% end %>
136     </ul>
137
138     <%= button_to 'Start Election!', :action => 'start_election', :id => @election.id %>
139   <% end %>
140
141 <% elsif @election.embeddable? %>
142
143 <div class="normal-header">
144   <span class="header">Embedding</span>
145   <span class="subheader"></span>
146 </div>
147
148
149 <p>To embed your election, copy and paste the following code into your
150 homepage:</p>
151
152 <pre><%= h("<iframe src='") + votepassword_url(:urlpassword => "open." + @election.id.to_s, :embed => "true") + h("' width='330px' height='#{(@election.candidates.length+2)*53}px'>" ) %>
153 <%= h("</iframe>") %></pre>
154
155 <% end %>

Benjamin Mako Hill || Want to submit a patch?