mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 13:17:20 -05:00
FEATURE: add filters on email logs
This commit is contained in:
@@ -8,13 +8,11 @@
|
||||
**/
|
||||
Discourse.AdminEmailIndexRoute = Discourse.Route.extend({
|
||||
|
||||
setupController: function(controller) {
|
||||
Discourse.EmailSettings.find().then(function (model) {
|
||||
controller.set('model', model);
|
||||
});
|
||||
model: function() {
|
||||
return Discourse.EmailSettings.find();
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
this.render('admin/templates/email_index', {into: 'adminEmail'});
|
||||
this.render('admin/templates/email_index', { into: 'adminEmail' });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
Handles routes related to viewing email logs.
|
||||
|
||||
@class AdminEmailLogsRoute
|
||||
@extends Discourse.Route
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailLogsRoute = Discourse.Route.extend({
|
||||
model: function() {
|
||||
return Discourse.EmailLog.findAll();
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
this.render('admin/templates/email_logs', {into: 'adminEmail'});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
Handles routes related to viewing email logs.
|
||||
|
||||
@class AdminEmailSentRoute
|
||||
@extends Discourse.Route
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailLogsRoute = Discourse.Route.extend({
|
||||
|
||||
model: function() {
|
||||
return Discourse.EmailLog.findAll({ status: this.get("status") });
|
||||
},
|
||||
|
||||
setupController: function(controller) {
|
||||
// resets the filters
|
||||
controller.set("filter", { status: this.get("status") });
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
this.render("admin/templates/email_" + this.get("status"), { into: "adminEmail" });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Discourse.AdminEmailSentRoute = Discourse.AdminEmailLogsRoute.extend({ status: "sent" });
|
||||
Discourse.AdminEmailSkippedRoute = Discourse.AdminEmailLogsRoute.extend({ status: "skipped" });
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
Handles routes related to viewing email logs of emails that were NOT sent.
|
||||
|
||||
@class AdminEmailSkippedRoute
|
||||
@extends Discourse.Route
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailSkippedRoute = Discourse.Route.extend({
|
||||
model: function() {
|
||||
return Discourse.EmailLog.findAll('skipped');
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
this.render('admin/templates/email_skipped', {into: 'adminEmail'});
|
||||
}
|
||||
});
|
||||
@@ -16,7 +16,7 @@ Discourse.Route.buildRoutes(function() {
|
||||
});
|
||||
|
||||
this.resource('adminEmail', { path: '/email'}, function() {
|
||||
this.route('logs');
|
||||
this.route('sent');
|
||||
this.route('skipped');
|
||||
this.route('previewDigest', { path: '/preview-digest' });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user