Introduced candidate voting and various tweaks

Merge branch 'develop'
This commit is contained in:
Mark Moser
2016-11-22 17:35:02 -06:00
58 changed files with 1064 additions and 31 deletions

View File

@ -1,11 +1,11 @@
<%
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Admin Login</h1>
<%= form_for :auth, url: admin_login_path do |form| %>
<% if flash[:error].present? %>
<div class="form-group">
Need a <%= link_to "password reset", admin_reset_request_path %>?

View File

@ -1,5 +1,6 @@
<%
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Password Reset</h1>

View File

@ -1,5 +1,6 @@
<%
content_for :main_class, "intro_tpl"
content_for :title, "Skills Assessment Admin"
%>
<h1>Password Reset</h1>

View File

@ -1,3 +1,7 @@
<%
content_for :title, "Edit Candidate - Skills Assessment Admin"
%>
<main class="intro_tpl">
<h1>Edit: <%= @candidate.name %></h1>
<p><strong>Test ID: </strong><%= @candidate.test_hash %></p>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Candidates"
content_for :title, "Candidates - Skills Assessment Admin"
%>
<main class="summary_tpl">
<%= link_to(admin_new_candidate_path, { class: 'secondary-btn' }) do %>
@ -15,6 +16,7 @@
<th>Progress</th>
<th>Completed</th>
<th>Reminded</th>
<th>Interview Request</th>
</tr>
<% @candidates.each do |candidate| %>
@ -28,8 +30,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 unless candidate.pending? %></td>
</tr>
<% end %>
</table>

View File

@ -1,3 +1,7 @@
<%
content_for :title, "New Candidate - Skills Assessment Admin"
%>
<main class="intro_tpl">
<h1>New Candidate</h1>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Edit: #{@user.name}"
content_for :title, "Profile - Skills Assessment Admin"
%>
<%= render partial: 'shared/form_model_errors', locals: {obj: @user} %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Profile"
content_for :title, "Profile - Skills Assessment Admin"
%>
<p>Name: <%= current_user.name %></p>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Questions"
content_for :title, "Edit Question - Skills Assessment Admin"
%>
<h1><%= @question.quiz.name %></h1>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Questions"
content_for :title, "Questions - Skills Assessment Admin"
%>
<% quizzes = @questions.group_by{ |q| q.quiz.name } %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "New Question"
content_for :title, "New Question - Skills Assessment Admin"
%>
<%= render partial: 'form', locals: {question: @question, action: admin_create_question_path } %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Question for #{@question.quiz.name}"
content_for :title, "Question - Skills Assessment Admin"
%>
<table cellspacing="0" cellpadding="0">

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Quizzes"
content_for :title, "Quizzes - Skills Assessment Admin"
%>
<%= render partial: 'admin/quiz/table_list', locals: { quizzes: @quizzes } %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "New Quiz"
content_for :title, "New Quiz - Skills Assessment Admin"
%>
<%= render partial: 'form', locals: { quiz: @quiz, action: admin_create_quiz_path } %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "#{@quiz.name}"
content_for :title, "Quiz - Skills Assessment Admin"
%>
<p><%= @quiz.name %></p>

View File

@ -0,0 +1,34 @@
<% # TODO: This needs to be extracted into a decorator, or something. It is only a quick hack solution. %>
<% if current_user.acts_as_reviewer? %>
<div class="review_meta__votes" data-id="vote-count">
<strong>Votes: </strong>
<%= 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 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>
<% end %>
<% 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 %>

View File

@ -1,5 +1,6 @@
<%
content_for :section_title, "Completed Tests"
content_for :title, "Quiz Results - Skills Assessment Admin"
%>
<main class="summary_tpl">
<table cellspacing="0" cellpadding="0">
@ -7,6 +8,7 @@
<th>Test ID</th>
<th>Experience</th>
<th>Recruiter</th>
<th>Interview Request</th>
</tr>
<% @candidates.each do |candidate| %>
@ -14,6 +16,7 @@
<td><%= link_to candidate.test_hash, admin_result_path(candidate.test_hash) %></td>
<td><%= candidate.experience %> years</td>
<td><%= mail_to(candidate.recruiter.email) %></td>
<td><%= candidate.review_status unless candidate.pending? %></td>
</tr>
<% end %>
</table>

View File

@ -1,10 +1,19 @@
<main class="summary_tpl">
<%
content_for :title, "Quiz Review - Skills Assessment Admin"
%>
<main class="summary_tpl admin-review">
<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><%= render partial: 'voting' %></div>
</div>
<% @quiz.each do |question| %>
<%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>

View File

@ -15,12 +15,20 @@
<%= form.select :role, admin_role_options(user.role), include_blank: false %>
</div>
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: 'checkbox'}) do | quiz | %>
<div class="form-group-multiples">
<%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %>
<%= quiz.label %>
</div>
<% end %>
<div class="form-group">
<div><strong>Quiz Review List</strong></div>
<p>
Quizzes this user should be reviewing the results of.<br />
Admins and Recruiters should not have any checked, unless they are expected
to participate in the technical review for that quiz.
</p>
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: 'checkbox'}) do | quiz | %>
<div class="form-group-multiples">
<%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %>
<%= quiz.label %>
</div>
<% end %>
</div>
<%= form.submit %>
<% end %>