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 %>

View File

@ -1,3 +1,5 @@
<% content_for :title, "Skills Assessment" %>
<main class="intro_tpl">
<h1 class="prft-heading">Oops!</h1>
<p>

View File

@ -1,3 +1,4 @@
<% content_for :title, "Saved! - Skills Assessment" %>
<main class="styleguide_tpl">
<p>
Your test results have been saved. You can visit again later with your Test ID to complete

View File

@ -1,3 +1,4 @@
<% content_for :title, "Thank You - Skills Assessment" %>
<main class="styleguide_tpl">
<h1>Thank you!</h1>
<p>

View File

@ -45,6 +45,17 @@
</noscript>
</div>
<div class="accordion" id="accordion<%= question.question_id %>" style="display: none;">
<input type="checkbox" class="accordion__toggle" id="accordion-toggle-live-coder" />
<label class="accordion__label" for="accordion-toggle-live-coder">How to use the live coder</label>
<p class="accordion__copy">
This is our own nifty creation, and it works similarly to CodePen. To use: type any HTML, CSS,
or JS inside their corresponding boxes, and watch the Results window below the boxes update
with your changes. Once youre happy with your code and how it renders in the Results window,
move on to the next question!
</p>
</div>
<div id="answer<%= question.question_id %>" data-id="live-coder-answer" style="display: none;">
<label for="answer_answer_hash_text">Enter answer here</label>
<%= text_area_tag 'answer[answer_hash][text]', value_text, { disabled: true, data: {last: answers['text']}} %>
@ -64,6 +75,7 @@
<%= text_area_tag 'answer[answer_hash][js]', value_js, { disabled: true, data: {id: 'code-js', last: answers['js']}, class: 'code-answer code-js' } %>
</div>
<label class="code-results">Results</label>
<div class="results" data-id="results"></div>
</div>
@ -71,6 +83,7 @@
<% # removes the no-js message %>
document.getElementById("nojs<%= question.question_id %>").style.display = "none";
document.getElementById("answer<%= question.question_id %>").style.display = "";
document.getElementById("accordion<%= question.question_id %>").style.display = "";
<% # we want the coders disabled until JS is confirmed, so form post is easier to validate %>
var coders = document.querySelectorAll("[data-id=live-coder-answer] textarea");

View File

@ -1,5 +1,5 @@
<%
content_for :title, "Skills Assessment"
content_for :title, "Summary - Skills Assessment"
content_for :footer_title, "Skills Assessment"
content_for :progress, @status.progress.to_s
content_for_javascript_once 'summary-edit' do