wired up vote ux

This commit is contained in:
Mark Moser
2016-11-20 11:24:17 -06:00
parent 5ef7f82dbf
commit 74b2415b91
6 changed files with 75 additions and 22 deletions

View File

@ -8,24 +8,33 @@
<strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
</div>
<div>
<div class="review_meta__votes">
<div class="review_meta__votes" data-id="vote-count">
<strong>Votes: </strong>
<%= link_to '#cast-vote-up', remote: true do %>
Yea (<%= @candidate.votes.yea.count %>)
<%= link_to admin_up_vote_path(test_hash: @candidate.test_hash), remote: true do %>
Yea (<span data-id="up-votes"><%= @candidate.votes.yea.count %></span>)
<% end %>
<%= link_to '#cast-vote-down', remote: true do %>
Nay (<%= @candidate.votes.nay.count %>)
<% end %>
</div>
<div class="review_meta__vetos">
<strong>Manager Vetos: </strong>
<%= link_to '#request', remote: true do %>
Request Interview
<% end %>
<%= link_to '#decline', remote: true do %>
Decline Interview
<%= link_to admin_down_vote_path(test_hash: @candidate.test_hash), remote: true do %>
Nay (<span data-id="down-votes"><%= @candidate.votes.nay.count %></span>)
<% end %>
<small>(Your vote: <span data-id="my-vote"><%= current_user.my_vote(@candidate) %></span>)</small>
</div>
<% if current_user.acts_as_manager? %>
<div class="review_meta__vetos" data-id="veto-status">
<strong>Manager Vetos: </strong>
<%= link_to admin_approve_vote_path(test_hash: @candidate.test_hash), remote: true do %>
<span data-id="interview-request">
<%= @candidate.approved? ? "Requested" : "Request Interview" %>
</span>
<% end %>
<%= link_to admin_decline_vote_path(test_hash: @candidate.test_hash), remote: true do %>
<span data-id="interview-decline">
<%= @candidate.declined? ? "Declined" : "Decline Interview" %>
</span>
<% end %>
</div>
<% else %>
<strong>Candidate Interview Status: </strong><%= @candidate.review_status %>
<% end %>
</div>
</div>