diff --git a/app/assets/stylesheets/molecules/_admin_review.scss b/app/assets/stylesheets/molecules/_admin_review.scss index dc1f8fb..f6776a5 100644 --- a/app/assets/stylesheets/molecules/_admin_review.scss +++ b/app/assets/stylesheets/molecules/_admin_review.scss @@ -28,6 +28,10 @@ margin-bottom: 30px; } + form { + margin-bottom: 30px; + } + .comment-message { margin-right: 5px; } diff --git a/app/controllers/admin/vote_controller.rb b/app/controllers/admin/vote_controller.rb index 538bebf..862410a 100644 --- a/app/controllers/admin/vote_controller.rb +++ b/app/controllers/admin/vote_controller.rb @@ -17,14 +17,27 @@ module Admin @candidate = Candidate.find_by(test_hash: params[:test_hash]) authorize ReviewerVote.find_by(user_id: current_user.id, candidate_id: @candidate.id) - current_user.review_candidate(@candidate, interview_params) - RecruiterMailer.candidate_reviewed(@candidate).deliver_later - redirect_to admin_result_path(@candidate.test_hash), - flash: { notice: "Quiz #{interview_params[:review_status]}" } + if interview_params[:review_comments].blank? + refuse_interview_request + else + send_interview_request + end end private + def refuse_interview_request + redirect_to admin_result_path(@candidate.test_hash), + flash: { error: "Must provide a comment" } + end + + def send_interview_request + current_user.review_candidate(@candidate, interview_params) + RecruiterMailer.candidate_reviewed(@candidate).deliver_later + redirect_to admin_result_path(@candidate.test_hash), + flash: { notice: "Quiz #{interview_params[:review_status]}" } + end + def interview_params params.permit(:review_status, :review_comments) end diff --git a/app/views/admin/result/_comment_form.html.erb b/app/views/admin/result/_comment_form.html.erb index 701cb7a..f67fd03 100644 --- a/app/views/admin/result/_comment_form.html.erb +++ b/app/views/admin/result/_comment_form.html.erb @@ -1,5 +1,3 @@ -<%= render partial: 'shared/form_model_errors', locals: { obj: comment } %> - <% if comment.id.nil? %> <%= form_for comment, url: admin_create_comment_path(test_hash: test_hash), method: :post do |form| %> diff --git a/app/views/admin/result/_voting.html.erb b/app/views/admin/result/_voting.html.erb index 689a7ae..4029c52 100644 --- a/app/views/admin/result/_voting.html.erb +++ b/app/views/admin/result/_voting.html.erb @@ -4,7 +4,7 @@