discourse/app/assets/javascripts/admin/routes/admin_logs_routes.js
2014-06-10 11:54:38 -04:00

108 lines
2.8 KiB
JavaScript

/**
Index redirects to a default logs index.
@class AdminLogsIndexRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.AdminLogsIndexRoute = Discourse.Route.extend({
redirect: function() {
this.transitionTo('adminLogs.staffActionLogs');
}
});
/**
The route that lists staff actions that were logged.
@class AdminLogsStaffActionLogsRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.AdminLogsStaffActionLogsRoute = Discourse.Route.extend({
renderTemplate: function() {
this.render('admin/templates/logs/staff_action_logs', {into: 'adminLogs'});
},
setupController: function(controller) {
var queryParams = Discourse.URL.get('queryParams');
if (queryParams) {
controller.set('filters', queryParams);
}
return controller.show();
},
actions: {
showDetailsModal: function(logRecord) {
Discourse.Route.showModal(this, 'admin_staff_action_log_details', logRecord);
this.controllerFor('modal').set('modalClass', 'log-details-modal');
},
showCustomDetailsModal: function(logRecord) {
Discourse.Route.showModal(this, logRecord.action_name + '_details', logRecord);
this.controllerFor('modal').set('modalClass', 'tabbed-modal log-details-modal');
}
},
deactivate: function() {
this._super();
// Clear any filters when we leave the route
Discourse.URL.set('queryParams', null);
}
});
/**
The route that lists blocked email addresses.
@class AdminLogsScreenedEmailsRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.AdminLogsScreenedEmailsRoute = Discourse.Route.extend({
renderTemplate: function() {
this.render('admin/templates/logs/screened_emails', {into: 'adminLogs'});
},
setupController: function() {
return this.controllerFor('adminLogsScreenedEmails').show();
}
});
/**
The route that lists screened IP addresses.
@class AdminLogsScreenedIpAddresses
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.AdminLogsScreenedIpAddressesRoute = Discourse.Route.extend({
renderTemplate: function() {
this.render('admin/templates/logs/screened_ip_addresses', {into: 'adminLogs'});
},
setupController: function() {
return this.controllerFor('adminLogsScreenedIpAddresses').show();
}
});
/**
The route that lists screened URLs.
@class AdminLogsScreenedUrlsRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.AdminLogsScreenedUrlsRoute = Discourse.Route.extend({
renderTemplate: function() {
this.render('admin/templates/logs/screened_urls', {into: 'adminLogs'});
},
setupController: function() {
return this.controllerFor('adminLogsScreenedUrls').show();
}
});