linked into views

This commit is contained in:
Mark Moser
2016-11-18 17:43:24 -06:00
committed by Mark Moser
parent 37aa17ec1f
commit 5845f76e1d
14 changed files with 107 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View File

@ -0,0 +1,12 @@
.review_meta {
@media screen and (min-width: 768px) {
display: flex;
& > div { flex: 1 1 auto; }
}
.review_meta__votes,
.review_meta__vetos {
a { padding: 5px; }
}
}

View File

@ -4,6 +4,7 @@ class Candidate < ApplicationRecord
has_many :questions, -> { order("sort") }, through: :quiz
has_many :answers
belongs_to :recruiter, class_name: "User"
has_many :votes, class_name: "ReviewerVote"
serialize :email, CryptSerializer
@ -15,6 +16,12 @@ class Candidate < ApplicationRecord
validates :email, uniqueness: true, presence: true, email_format: true
validates :test_hash, uniqueness: true, presence: true
enum review_status: {
# pending: 0,
approved: 1,
declined: 2
}
def submitted_answers
answers.where(submitted: true)
end

View File

@ -1,10 +1,10 @@
# frozen_string_literal: true
class ReviewerVote < ApplicationRecord
# validates :user_id, uniqueness: {scope: :friend_id}
belongs_to :candidate
belongs_to :user
validates :user_id, uniqueness: { scope: :candidate_id }
enum vote: {
undecided: 0,
yea: 1,

View File

@ -15,6 +15,7 @@
<th>Progress</th>
<th>Completed</th>
<th>Reminded</th>
<th>Review Status</th>
</tr>
<% @candidates.each do |candidate| %>
@ -28,8 +29,9 @@
</td>
<td><%= candidate.experience %> years</td>
<td><%= candidate.status %></td>
<td><%= candidate.completed ? "Submitted" : "" %></td>
<td><%= candidate.completed ? link_to("Submitted", admin_result_path(candidate.test_hash)) : "" %></td>
<td><%= candidate.reminded ? "Yes" : "" %></td>
<td><%= candidate.review_status %></td>
</tr>
<% end %>
</table>

View File

@ -1,10 +1,33 @@
<main class="summary_tpl">
<h2 class="prft-heading">Quiz Review</h2>
<p>
<strong>Test ID:</strong> <%= @candidate.test_hash %><br />
<strong>Years of Experience:</strong> <%= @candidate.experience %><br />
<strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
</p>
<div class="review_meta">
<div>
<strong>Test ID:</strong> <%= @candidate.test_hash %><br />
<strong>Years of Experience:</strong> <%= @candidate.experience %><br />
<strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
</div>
<div>
<div class="review_meta__votes">
<strong>Votes: </strong>
<%= link_to '#cast-vote-up', remote: true do %>
Yea (<%= @candidate.votes.yea.count %>)
<% 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
<% end %>
</div>
</div>
</div>
<% @quiz.each do |question| %>
<%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>