Commit b8aff26c by Julia Hansbrough Committed by Brian Wilson

Merged in email confirmation modal

parent 3f88b879
...@@ -23,21 +23,31 @@ class SendEmail ...@@ -23,21 +23,31 @@ class SendEmail
@$btn_send.click => @$btn_send.click =>
success_message = gettext('Your email was successfully queued for sending.') if @$subject.val() == ""
alert gettext("Your message must have a subject.")
send_data = else if @$emailEditor.save()['data'] == ""
action: 'send' alert gettext("Your message cannot be blank.")
send_to: @$send_to.val() else
subject: @$subject.val() send_to = @$send_to.val().toLowerCase()
message: @$emailEditor.save()['data'] if send_to == "myself"
send_to = gettext("yourself")
$.ajax subject = gettext(@$subject.val())
type: 'POST' confirm_message = gettext("You are about to send an email titled \"#{subject}\" to #{send_to}. Is this OK?")
dataType: 'json' if confirm confirm_message
url: @$btn_send.data 'endpoint'
data: send_data send_data =
success: (data) => @display_response ("<div class=\"msg msg-confirm\"><p class=\"copy\">" + success_message + "</p></div>") action: 'send'
error: std_ajax_err => @fail_with_error gettext('Error sending email.') send_to: @$send_to.val()
subject: @$subject.val()
message: @$emailEditor.save()['data']
$.ajax
type: 'POST'
dataType: 'json'
url: @$btn_send.data 'endpoint'
data: send_data
success: (data) => @display_response gettext('Your email was successfully queued for sending.')
error: std_ajax_err => @fail_with_error gettext('Error sending email.')
fail_with_error: (msg) -> fail_with_error: (msg) ->
console.warn msg console.warn msg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment