Working on send test email in sending_profiles page

pull/169/head
William Woodson 2016-02-22 06:25:29 -06:00
parent a2ee229848
commit a3376a702f
2 changed files with 61 additions and 62 deletions

View File

@ -1,38 +1,38 @@
var profiles = [] var profiles = []
// Attempts to send a test email by POSTing to /campaigns/ // Attempts to send a test email by POSTing to /campaigns/
/*function sendTestEmail() { function sendTestEmail() {
var test_email_request = { var test_email_request = {
template: { name: '' }, template: { name: '' },
first_name: $("input[name=to_first_name]").val(), first_name: $("input[name=to_first_name]").val(),
last_name: $("input[name=to_last_name]").val(), last_name: $("input[name=to_last_name]").val(),
email: $("input[name=to_email]").val(), email: $("input[name=to_email]").val(),
position: $("input[name=to_position]").val(), position: $("input[name=to_position]").val(),
url: '', url: '',
page: { name: '' }, page: { name: '' },
smtp: { smtp: {
from_address: $("#from").val(), from_address: $("#from").val(),
host: $("#host").val(), host: $("#host").val(),
username: $("#username").val(), username: $("#username").val(),
password: $("#password").val(), password: $("#password").val(),
ignore_cert_errors: $("#ignore_cert_errors").prop("checked") ignore_cert_errors: $("#ignore_cert_errors").prop("checked")
} }
} }
btnHtml = $("#sendTestModalSubmit").html() btnHtml = $("#sendTestModalSubmit").html()
$("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending') $("#sendTestModalSubmit").html('<i class="fa fa-spinner fa-spin"></i> Sending')
// Send the test email // Send the test email
api.send_test_email(test_email_request) api.send_test_email(test_email_request)
.success(function(data) { .success(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\ $("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-success\">\
<i class=\"fa fa-check-circle\"></i> Email Sent!</div>") <i class=\"fa fa-check-circle\"></i> Email Sent!</div>")
$("#sendTestModalSubmit").html(btnHtml) $("#sendTestModalSubmit").html(btnHtml)
}) })
.error(function(data) { .error(function(data) {
$("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\ $("#sendTestEmailModal\\.flashes").empty().append("<div style=\"text-align:center\" class=\"alert alert-danger\">\
<i class=\"fa fa-exclamation-circle\"></i> " + data.responseJSON.message + "</div>") <i class=\"fa fa-exclamation-circle\"></i> " + data.responseJSON.message + "</div>")
$("#sendTestModalSubmit").html(btnHtml) $("#sendTestModalSubmit").html(btnHtml)
}) })
}*/ //disable sendTestEmail functionality on sending profile page until update handling of /util/send_test_email }
// Save attempts to POST to /smtp/ // Save attempts to POST to /smtp/
function save(idx) { function save(idx) {

View File

@ -86,7 +86,7 @@
<input id="ignore_cert_errors" type="checkbox" checked> <input id="ignore_cert_errors" type="checkbox" checked>
<label for="ignore_cert_errors">Ignore Certificate Errors <i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right" title="Ignore common certificate errors such as self-signed certs (exposes you to MiTM attacks - use carefully!)"></i></label> <label for="ignore_cert_errors">Ignore Certificate Errors <i class="fa fa-question-circle" data-toggle="tooltip" data-placement="right" title="Ignore common certificate errors such as self-signed certs (exposes you to MiTM attacks - use carefully!)"></i></label>
</div> </div>
<!-- <button type="button" data-toggle="modal" data-target="#sendTestEmailModal" class="btn btn-primary"><i class="fa fa-envelope"></i> Send Test Email</button> --> <button type="button" data-toggle="modal" data-target="#sendTestEmailModal" class="btn btn-primary"><i class="fa fa-envelope"></i> Send Test Email</button>
<!-- disable sendTestEmail functionality on sending profile page until update handling of /util/send_test_email --> <!-- disable sendTestEmail functionality on sending profile page until update handling of /util/send_test_email -->
</div> </div>
</div> </div>
@ -98,43 +98,42 @@
</div> </div>
</div> </div>
<!-- Send Test Email Modal --> <!-- Send Test Email Modal -->
<!-- <div class="modal" id="sendTestEmailModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel"> <div class="modal" id="sendTestEmailModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> --> <div class="modal-content">
<!-- New Email Modal --> <!-- New Email Modal -->
<!-- <div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="sendTestEmailModalTitle">Send Test Email</h4> <h4 class="modal-title" id="sendTestEmailModalTitle">Send Test Email</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row" id="sendTestEmailModal.flashes"></div> <div class="row" id="sendTestEmailModal.flashes"></div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<label class="control-label" for="to">Send Test Email to:</label> <label class="control-label" for="to">Send Test Email to:</label>
</div> </div>
<br> <br>
<div class="col-sm-2"> <div class="col-sm-2">
<input type="text" class="form-control" placeholder="First Name" name="to_first_name"> <input type="text" class="form-control" placeholder="First Name" name="to_first_name">
</div> </div>
<div class="col-sm-2"> <div class="col-sm-2">
<input type="text" class="form-control" placeholder="Last Name" name="to_last_name"> <input type="text" class="form-control" placeholder="Last Name" name="to_last_name">
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<input type="email" class="form-control" placeholder="Email" name="to_email" required> <input type="email" class="form-control" placeholder="Email" name="to_email" required>
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<input type="text" class="form-control" placeholder="Position" name="to_position"> <input type="text" class="form-control" placeholder="Position" name="to_position">
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button> <button type="button" data-dismiss="modal" class="btn btn-default">Cancel</button>
<button type="button" class="btn btn-primary" id="sendTestModalSubmit" onclick="sendTestEmail()"><i class="fa fa-envelope"></i> Send</button> <button type="button" class="btn btn-primary" id="sendTestModalSubmit" onclick="sendTestEmail()"><i class="fa fa-envelope"></i> Send</button>
</div> </div>
</div> </div>
</div> </div>
</div> --> </div>
<!-- disable sendTestEmail functionality on sending profile page until update handling of /util/send_test_email -->
{{end}} {{end}}
{{define "scripts"}} {{define "scripts"}}
<script src="/js/ckeditor/ckeditor.js"></script> <script src="/js/ckeditor/ckeditor.js"></script>