2013-02-22 15:41:12 -05:00
|
|
|
/**
|
2013-06-03 16:12:24 -04:00
|
|
|
This controller supports email functionality.
|
2013-02-20 13:15:50 -05:00
|
|
|
|
2013-06-03 16:12:24 -04:00
|
|
|
@class AdminEmailIndexController
|
|
|
|
@extends Discourse.Controller
|
2013-02-22 15:41:12 -05:00
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-05 15:39:21 -05:00
|
|
|
**/
|
2013-06-03 16:12:24 -04:00
|
|
|
Discourse.AdminEmailIndexController = Discourse.Controller.extend(Discourse.Presence, {
|
2013-03-05 15:39:21 -05:00
|
|
|
|
2013-02-21 12:58:21 -05:00
|
|
|
/**
|
2013-02-22 15:41:12 -05:00
|
|
|
Is the "send test email" button disabled?
|
2013-02-21 12:58:21 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
@property sendTestEmailDisabled
|
2013-03-05 15:39:21 -05:00
|
|
|
**/
|
2013-06-03 16:12:24 -04:00
|
|
|
sendTestEmailDisabled: Em.computed.empty('testEmailAddress'),
|
|
|
|
|
|
|
|
/**
|
|
|
|
Clears the 'sentTestEmail' property on successful send.
|
|
|
|
|
|
|
|
@method testEmailAddressChanged
|
|
|
|
**/
|
|
|
|
testEmailAddressChanged: function() {
|
|
|
|
this.set('sentTestEmail', false);
|
|
|
|
}.observes('testEmailAddress'),
|
|
|
|
|
2013-02-21 14:42:48 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
/**
|
|
|
|
Sends a test email to the currently entered email address
|
2013-02-20 13:15:50 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
@method sendTestEmail
|
|
|
|
**/
|
|
|
|
sendTestEmail: function() {
|
2013-04-03 16:06:55 -04:00
|
|
|
this.set('sentTestEmail', false);
|
|
|
|
|
|
|
|
var adminEmailLogsController = this;
|
2013-06-03 16:12:24 -04:00
|
|
|
Discourse.ajax("/admin/email/test", {
|
2013-02-22 15:41:12 -05:00
|
|
|
type: 'POST',
|
2013-04-03 16:06:55 -04:00
|
|
|
data: { email_address: this.get('testEmailAddress') }
|
|
|
|
}).then(function () {
|
|
|
|
adminEmailLogsController.set('sentTestEmail', true);
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|
2013-04-03 16:06:55 -04:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
}
|
2013-03-05 15:39:21 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|