recruiter Resend welcome email
This commit is contained in:
parent
9884748cf9
commit
372e86507e
16
app/assets/javascripts/ajax-links.js
Normal file
16
app/assets/javascripts/ajax-links.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
function handleAjaxResponse($el) {
|
||||||
|
var $header = $('header');
|
||||||
|
$el.on("ajax:success", function(e, data){
|
||||||
|
$header.after('<div class="success">' + data.message + '</div>');
|
||||||
|
}).on("ajax:error", function(e, xhr) {
|
||||||
|
if (xhr.status === 400){
|
||||||
|
$header.after('<div class="error">' + xhr.responseJSON.join('<br>') + '</div>');
|
||||||
|
} else {
|
||||||
|
$header.after('<div class="error">Oops! There was an error processing your request. Please try again.</div>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('[data-id=ajax-action]').each(function(){ handleAjaxResponse($(this)); });
|
||||||
|
});
|
@ -15,6 +15,8 @@
|
|||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require modernizr-lite/modernizr
|
//= require modernizr-lite/modernizr
|
||||||
|
|
||||||
|
//= require ajax-links
|
||||||
|
|
||||||
//= require forms/button-group
|
//= require forms/button-group
|
||||||
//= require forms/animations
|
//= require forms/animations
|
||||||
//= require forms/textarea-limit
|
//= require forms/textarea-limit
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* global updateResults */
|
/* global updateResults */
|
||||||
/* TODO: remove global ^ once live-coder is properly name spaced */
|
// TODO: remove global ^ once live-coder is properly name spaced
|
||||||
/**
|
/**
|
||||||
* Summary Page Answer Editor
|
* Summary Page Answer Editor
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,28 @@
|
|||||||
@keyframes success-fadeout {
|
@keyframes success-fadeout {
|
||||||
0% { opacity: 1; max-height: 40px; }
|
0% {
|
||||||
85% { opacity: 0; max-height: 40px; padding: .5rem 0; margin-bottom: .5rem; }
|
max-height: 40px;
|
||||||
100% { opacity: 0; max-height: 0; padding: 0; margin-bottom: 0; }
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
85% {
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
max-height: 40px;
|
||||||
|
opacity: 0;
|
||||||
|
padding: .5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
96% {
|
||||||
|
margin-bottom: 0;
|
||||||
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
height: 0;
|
||||||
|
left: -10px;
|
||||||
|
position: absolute;
|
||||||
|
top: -10px;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,12 @@ class RecruiterController < ApplicationController
|
|||||||
redirect_to recruiter_login_path
|
redirect_to recruiter_login_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resend_welcome
|
||||||
|
candidate = Candidate.find_by(id: params[:id])
|
||||||
|
CandidateMailer.welcome(candidate).deliver_later
|
||||||
|
render json: { message: "Email queued!" }.to_json
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def candidate_params
|
def candidate_params
|
||||||
|
@ -20,7 +20,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= candidate.name %></td>
|
<td><%= candidate.name %></td>
|
||||||
<td><%= candidate.test_hash %></td>
|
<td><%= candidate.test_hash %></td>
|
||||||
<td><%= mail_to(candidate.email) %></td>
|
<td>
|
||||||
|
<%= mail_to(candidate.email) %>
|
||||||
|
<br />
|
||||||
|
<%= link_to "resend welcome email", resend_welcome_path(candidate.id), remote: true, class: '', data: { id: 'ajax-action' } %>
|
||||||
|
</td>
|
||||||
<td><%= candidate.experience %> years</td>
|
<td><%= candidate.experience %> years</td>
|
||||||
<td><%= candidate.status %></td>
|
<td><%= candidate.status %></td>
|
||||||
<td><%= candidate.completed ? "Submitted" : "" %></td>
|
<td><%= candidate.completed ? "Submitted" : "" %></td>
|
||||||
|
@ -60,6 +60,8 @@ Rails.application.routes.draw do
|
|||||||
get "/review", to: "review#index", as: :review
|
get "/review", to: "review#index", as: :review
|
||||||
get "/review/:test_hash", to: "review#view", as: :review_test
|
get "/review/:test_hash", to: "review#view", as: :review_test
|
||||||
|
|
||||||
|
get "/resend/welcome/:id", to: "recruiter#resend_welcome", as: :resend_welcome
|
||||||
|
|
||||||
get "/recruiter", to: "recruiter#index", as: :recruiter
|
get "/recruiter", to: "recruiter#index", as: :recruiter
|
||||||
get "/recruiter/new-candidate", to: "recruiter#new", as: :new_candidate
|
get "/recruiter/new-candidate", to: "recruiter#new", as: :new_candidate
|
||||||
post "/recruiter/new-candidate", to: "recruiter#create", as: :create_candidate
|
post "/recruiter/new-candidate", to: "recruiter#create", as: :create_candidate
|
||||||
|
@ -102,4 +102,15 @@ class RecruiterControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert assigns(:candidate), "@candidate not present"
|
assert assigns(:candidate), "@candidate not present"
|
||||||
assert_match(/failed.*save/i, flash[:error])
|
assert_match(/failed.*save/i, flash[:error])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'should queue up a welcome email [resend]' do
|
||||||
|
auth_recruiter
|
||||||
|
|
||||||
|
assert_enqueued_jobs 1 do
|
||||||
|
get resend_welcome_path(id: candidates(:peggy)), xhr: true
|
||||||
|
end
|
||||||
|
assert_response :success
|
||||||
|
data = JSON.parse(response.body)
|
||||||
|
assert_match 'queued', data["message"]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user