Added a link to open elections off the election's 'show' page
[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.active? %>
7   <div id="status">Vote is in currently in progress. Return to
8         this page for results on <%= @election.enddate %>.</div>
9 <% elsif @election.done? %>
10   <div id="status">Election is finished. <%= link_to "View results",
11   :action => 'results', :id => @election.id %>.</div>
12 <% else %>
13   <p style="text-align: right;">
14     <%= link_to "Edit General Information",
15                 :action => 'edit_general_information', :id => @election.id %>
16   </p>
17 <% end %>
18
19 <p><strong>Summary</strong></p>
20
21 <blockquote>
22 <%= h(@election.name) %>
23 </blockquote>
24
25 <p><strong>Description</strong></p>
26
27 <blockquote>
28 <%= h(@election.description) %>
29 </blockquote>
30
31 <p><strong>Additional Information</strong></p>
32
33 <ul> <li>Elections will end at <strong><%= @election.enddate
34 %></strong>.</li> <li>Elections results <strong><% if
35 @election.early_results %>will be<% else %>will not be<% end
36 %></strong> will be visible while election is in progress.</li>
37
38 <% if @election.embeddable %>
39 <li>Elections <strong>will be</strong> embeddable.</li>
40 <% end %>
41
42 </ul>
43
44 <% unless @election.authenticated -%>
45 <p><strong>Link</strong></p>
46 <%= (link_to ("Go Vote!", 
47             :controller => 'voter', :action => 'index', :election_id => @election.id)).to_s %>
48 <% end -%>
49
50 <div class="normal-header">
51   <span class="header">Candidates</span>
52   <span class="subheader"></span>
53 </div>
54
55
56 <% if not (@election.active? or @election.done?) %>
57   <p style="text-align: right;">
58     <%= link_to "Edit Candidates",
59                :action => 'edit_candidates', :id => @election.id %></p>
60 <% end %>
61
62
63 <% if @election.candidates.empty? %>
64   <p><em>There are currently no candidates registered.</em>
65      <%= link_to "Add some!", :action => 'edit_candidates', :id => @election.id %>
66   </p>
67 <% else %>
68   <%= render :partial => 'candidate_list' %>
69 <% end %>
70
71 <div class="normal-header">
72   <span class="header">Voters</span>
73   <span class="subheader"></span>
74 </div>
75
76 <% if not (@election.active?  or @election.done?) %>
77 <p style="text-align: right;">
78   <%= link_to "Change Voters/Options",
79               :action => 'edit_voters', :id => @election.id %></p>
80 <% end %>
81
82 <% if not @election.authenticated? %>
83   <p><em>This election is open the public.</em></p>
84 <% elsif @election.voters.empty? %>
85   <p><em>There are currently no voters registered. </em>
86      <%= link_to "Add some!", :action => 'edit_voters',
87                  :id => @election.id %></p>
88 <% else %>
89   <%= render :partial => 'voter_list' %>
90   <p><em><%= link_to "Add or remove voters.", :action => 'edit_voters',
91               :id => @election.id unless @election.active? or @election.done? %>
92   </em></p>
93 <% end %>
94
95 <% if not (@election.active? or @election.done?)  %>
96
97 <div class="normal-header">
98   <span class="header">Start Election</span>
99   <span class="subheader"></span>
100 </div>
101
102   <% if @election.start_blockers.length > 0 %>
103     <p>Your vote cannot be started for the following reasons:</p>
104     <ul>
105     <% for reason in @election.start_blockers %>
106     <li><%= reason %></li>
107     <% end %>
108     </ul>
109   <% else %>
110     <p>Please check everything carefully on this page before starting this
111     vote. Once you begin the vote, you will <em>not</em> be able to add or
112     change candidates, modify the voting lists, or change the end
113     time.</p>
114
115     <p>When you begin the vote, the following will happen:</p>
116
117     <ul>
118     <li>The vote will be "frozen" so that further edits to the
119         candidate list and voting list cannot occur.</li>
120     <% if @election.authenticated? %>
121     <li>All voters will be emailed notifying them that the vote has
122         begun and of their unique login token.</li>
123     <% end %>
124     </ul>
125
126     <%= button_to 'Start Election!', :action => 'start_election', :id => @election.id %>
127   <% end %>
128
129 <% elsif @election.embeddable? %>
130
131 <div class="normal-header">
132   <span class="header">Embedding</span>
133   <span class="subheader"></span>
134 </div>
135
136
137 <p>To embed your election, copy and paste the following code into your
138 homepage:</p>
139
140 <pre><%= h("<iframe src='") + votepassword_url(:urlpassword => "open." + @election.id.to_s, :embed => "true") + h("' width='330px' height='370px'>") %>
141 <%= h("</iframe>") %></pre>
142
143 <% end %>

Benjamin Mako Hill || Want to submit a patch?