a long variety of improvements and tweaks
[selectricity] / app / views / election / edit_candidates.rhtml
index 0c416d5ee071cb757a11c9b3ff73e10869b23333..cc2c16a8a9ebb33225f95609456e9d90f11d2308 100644 (file)
@@ -1,14 +1,25 @@
-<% @edit = true %>
-<h1><strong><%= @election.name %>:</strong> Edit Candidates</h1>
+<h1>Edit/Add Candidates</h1>
 
-<p>The following are valid options or candidates in this election:</p>
+<%= error_messages_for :candidate %>
 
-<ul>
-<% @election.candidates.each do |candidate| %>
-   <% @candidate = candidate %>
-   <%= render :partial => 'candidate_line' %>
+<% unless @election.candidates.empty? %>
+  <p>The following are valid options or candidates in this election:</p>
+
+  <% @election.candidates.each do |candidate| %>
+    <% @current_candidate = candidate %>
+    <%= render :partial => 'candidate_line_edit' %>
+  <% end %>
+
+<% else %>
+  <p>There are no candidates registered for this election.</p>
 <% end %>
-</ul>
 
-<%= render :partial => 'candidates_form' %>
+<p>Please enter new candidates below.</p>
+
+<%= form_tag( { :action => :add_candidate, :id => @election.id },
+              :multipart => true ) %>
+<%= render :partial => 'candidate_form' %>
+<%= submit_tag "Add Candidate" %>
+<%= end_form_tag %>
+
 <%= button_to "Done!", :action => 'show', :id => @election %>

Benjamin Mako Hill || Want to submit a patch?