Commit 446866c2 authored by April Guian's avatar April Guian

Added CRUD to Positions

parent 4f024caf
......@@ -7,7 +7,7 @@ class CandidatesController < ApplicationController
def show
@candidate = Candidate.find(params[:id])
#@user = @candidate.user
@user = @candidate.user
#@users = User.all
render "candidates/show.html.erb"
end
......
......@@ -2,14 +2,21 @@
<% @positions.each do |c| %>
<h2>(<%= c.id %>) <%= c.name %></h2>
<%= link_to "Edit Position", edit_admin_position_path(c.id) %>
<%= link_to "Delete Position", admin_position_path(c.id), method: :delete, data: { confirm: 'Are you sure?' } %>
<ul>
<% c.candidates.each do |p| %>
<li><%= link_to "#{p.first_name} #{p.last_name}" , admin_candidate_path(p.id) %></li>
<% end %>
</ul>
<%= link_to "View all Candidates under #{c.name}" , "admin/positions/#{c.id}" %>
<% end %>
<hr>
<%= link_to("Add New Position", new_admin_position_path) %>
<hr>
......
......@@ -17,7 +17,7 @@
<td><%= c.slogan %></td>
<td><%= c.position.name %></td>
<td>
<%= link_to "Show", position_path(c.id) %>
<%= link_to "Show", candidate_path(c.id) %>
</td>
</tr>
<% end %>
......
<h1> <%= Create a profile page that displays all the candidates that the user voted %> </h1>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment