Legacy email tests, removed duplicate code, updated comments, fixed CSS

This commit is contained in:
Julia Hansbrough
2013-10-07 17:59:58 +00:00
committed by Brian Wilson
parent fd54b060d8
commit 8a30e9ba8f
15 changed files with 303 additions and 321 deletions

View File

@@ -27,9 +27,15 @@ class SendEmail
else if @$emailEditor.save()['data'] == ""
alert gettext("Your message cannot be blank.")
else
success_message = gettext("Your email was successfully queued for sending.")
send_to = @$send_to.val().toLowerCase()
if send_to == "myself"
send_to = gettext("yourself")
else if send_to == "staff"
send_to = gettext("everyone who is staff or instructor on this course")
else
send_to = gettext("ALL (everyone who is enrolled in this course as student, staff, or instructor)")
success_message = gettext("Your email was successfully queued for sending. Please note that for large public classes (~10k), it may take 1-2 hours to send all emails.")
subject = gettext(@$subject.val())
confirm_message = gettext("You are about to send an email titled \"#{subject}\" to #{send_to}. Is this OK?")
if confirm confirm_message
@@ -46,21 +52,27 @@ class SendEmail
url: @$btn_send.data 'endpoint'
data: send_data
success: (data) =>
@display_response gettext('Your email was successfully queued for sending.')
$(".msg-confirm").css({"display":"block"})
error: std_ajax_err => @fail_with_error gettext('Error sending email.')
$(".msg-confirm").css({"display":"none"})
@display_response success_message
error: std_ajax_err =>
@fail_with_error gettext('Error sending email.')
else
@$task_response.empty()
@$request_response_error.empty()
fail_with_error: (msg) ->
console.warn msg
@$task_response.empty()
@$request_response_error.empty()
@$request_response_error.text gettext(msg)
$(".msg-confirm").css({"display":"none"})
display_response: (data_from_server) ->
@$task_response.empty()
@$request_response_error.empty()
@$task_response.text(gettext('Your email was successfully queued for sending.'))
@$task_response.text(data_from_server)
$(".msg-confirm").css({"display":"block"})
# Email Section

View File

@@ -22,8 +22,9 @@
// system feedback - messages
.msg {
border-radius: 1px;
padding: 10px 15px;
margin-bottom: 20px;
padding: $baseline/2 $baseline*0.75;
margin-bottom: $baseline;
font-weight: 600;
.copy {
font-weight: 600;
@@ -44,10 +45,8 @@
.msg-confirm {
border-top: 2px solid $confirm-color;
background: tint($confirm-color,95%);
.copy {
color: $confirm-color;
}
display: none;
color: $confirm-color;
}
// TYPE: confirm
@@ -76,7 +75,7 @@
.list-advice {
list-style: none;
padding: 0;
margin: 20px 0;
margin: $baseline 0;
.item {
font-weight: 600;
@@ -249,7 +248,7 @@ section.instructor-dashboard-content-2 {
padding: 0;
.field {
margin-bottom: 20px;
margin-bottom: $baseline;
padding: 0;
&:last-child {
@@ -257,43 +256,6 @@ section.instructor-dashboard-content-2 {
}
}
}
// system feedback - messages
.msg {
border-radius: 1px;
padding: 10px 15px;
margin-bottom: 20px;
font-weight: 600;
color: green;
.copy {
font-weight: 600;
}
}
.msg-confirm {
background: tint(green,90%);
display: none;
}
.list-advice {
list-style: none;
padding: 0;
margin: 20px 0;
.item {
font-weight: 600;
margin-bottom: 10px;
&:last-child {
margin-bottom: 0;
}
}
}
.copy {
font-weight: 600; }
.msg-confirm {
background: #e5f2e5; }
}