From a3376a702fa7a5232cf2d1c83fde27dbf63d9573 Mon Sep 17 00:00:00 2001 From: William Woodson Date: Mon, 22 Feb 2016 06:25:29 -0600 Subject: [PATCH] Working on send test email in sending_profiles page --- static/js/app/sending_profiles.js | 54 ++++++++++++------------ templates/sending_profiles.html | 69 +++++++++++++++---------------- 2 files changed, 61 insertions(+), 62 deletions(-) diff --git a/static/js/app/sending_profiles.js b/static/js/app/sending_profiles.js index 7d016afa..e79e13e0 100644 --- a/static/js/app/sending_profiles.js +++ b/static/js/app/sending_profiles.js @@ -1,38 +1,38 @@ var profiles = [] // Attempts to send a test email by POSTing to /campaigns/ -/*function sendTestEmail() { +function sendTestEmail() { var test_email_request = { - template: { name: '' }, - first_name: $("input[name=to_first_name]").val(), - last_name: $("input[name=to_last_name]").val(), - email: $("input[name=to_email]").val(), - position: $("input[name=to_position]").val(), - url: '', - page: { name: '' }, - smtp: { - from_address: $("#from").val(), - host: $("#host").val(), - username: $("#username").val(), - password: $("#password").val(), - ignore_cert_errors: $("#ignore_cert_errors").prop("checked") - } + template: { name: '' }, + first_name: $("input[name=to_first_name]").val(), + last_name: $("input[name=to_last_name]").val(), + email: $("input[name=to_email]").val(), + position: $("input[name=to_position]").val(), + url: '', + page: { name: '' }, + smtp: { + from_address: $("#from").val(), + host: $("#host").val(), + username: $("#username").val(), + password: $("#password").val(), + ignore_cert_errors: $("#ignore_cert_errors").prop("checked") + } } btnHtml = $("#sendTestModalSubmit").html() $("#sendTestModalSubmit").html(' Sending') - // Send the test email + // Send the test email api.send_test_email(test_email_request) - .success(function(data) { - $("#sendTestEmailModal\\.flashes").empty().append("
\ - Email Sent!
") - $("#sendTestModalSubmit").html(btnHtml) - }) - .error(function(data) { - $("#sendTestEmailModal\\.flashes").empty().append("
\ - " + data.responseJSON.message + "
") - $("#sendTestModalSubmit").html(btnHtml) - }) -}*/ //disable sendTestEmail functionality on sending profile page until update handling of /util/send_test_email + .success(function(data) { + $("#sendTestEmailModal\\.flashes").empty().append("
\ + Email Sent!
") + $("#sendTestModalSubmit").html(btnHtml) + }) + .error(function(data) { + $("#sendTestEmailModal\\.flashes").empty().append("
\ + " + data.responseJSON.message + "
") + $("#sendTestModalSubmit").html(btnHtml) + }) +} // Save attempts to POST to /smtp/ function save(idx) { diff --git a/templates/sending_profiles.html b/templates/sending_profiles.html index 5274e695..f57f75d3 100644 --- a/templates/sending_profiles.html +++ b/templates/sending_profiles.html @@ -86,7 +86,7 @@ - + @@ -98,43 +98,42 @@ - - - + + + - --> - + {{end}} {{define "scripts"}}