Commit 21d19466 authored by Bianca Tarun's avatar Bianca Tarun

fixed candidates index page

parent db7fe67b
...@@ -3,7 +3,6 @@ class CandidatesController < ApplicationController ...@@ -3,7 +3,6 @@ class CandidatesController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def index def index
@candidates = Candidate.all
@positions = Position.all @positions = Position.all
render "admin/candidates/index.html.erb" render "admin/candidates/index.html.erb"
end end
......
...@@ -2,9 +2,14 @@ ...@@ -2,9 +2,14 @@
<hr> <hr>
<%= link_to("New Candidate", new_admin_candidate_path) %> <%= link_to("New Candidate", new_admin_candidate_path) %>
<hr> <hr>
<% @positions.each do |position| %> <% @positions.each do |p| %>
<h2><%= @position.name %></h2> <h2><%= p.name %></h2>
<ul><% p.candidates.each do |candidate| %></ul>
<%= candidate.first_name %> <%= candidate.last_name %>
<%= link_to "Show", admin_candidate_path(candidate.id) %>
<%= link_to "Edit", edit_admin_candidate_path(candidate.id) %>
<%= link_to "Delete", admin_candidate_path(candidate.id), method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
<% end %> <% end %>
<hr>
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