diff --git a/app/assets/javascripts/admin/controllers/admin_logs_screened_urls_controller.js b/app/assets/javascripts/admin/controllers/admin_logs_screened_urls_controller.js new file mode 100644 index 00000000000..c14d95c2337 --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin_logs_screened_urls_controller.js @@ -0,0 +1,21 @@ +/** + This controller supports the interface for listing screened URLs in the admin section. + + @class AdminLogsScreenedUrlsController + @extends Ember.ArrayController + @namespace Discourse + @module Discourse +**/ +Discourse.AdminLogsScreenedUrlsController = Ember.ArrayController.extend(Discourse.Presence, { + loading: false, + content: [], + + show: function() { + var self = this; + this.set('loading', true); + Discourse.ScreenedUrl.findAll().then(function(result) { + self.set('content', result); + self.set('loading', false); + }); + } +}); diff --git a/app/assets/javascripts/admin/models/screened_email.js b/app/assets/javascripts/admin/models/screened_email.js index 21209ad436f..d2f524414c1 100644 --- a/app/assets/javascripts/admin/models/screened_email.js +++ b/app/assets/javascripts/admin/models/screened_email.js @@ -9,7 +9,7 @@ **/ Discourse.ScreenedEmail = Discourse.Model.extend({ actionName: function() { - return I18n.t("admin.logs.screened_emails.actions." + this.get('action')); + return I18n.t("admin.logs.screened_actions." + this.get('action')); }.property('action') }); diff --git a/app/assets/javascripts/admin/models/screened_url.js b/app/assets/javascripts/admin/models/screened_url.js new file mode 100644 index 00000000000..592726f4840 --- /dev/null +++ b/app/assets/javascripts/admin/models/screened_url.js @@ -0,0 +1,23 @@ +/** + Represents a URL that is watched for, and an action may be taken. + + @class ScreenedUrl + @extends Discourse.Model + @namespace Discourse + @module Discourse +**/ +Discourse.ScreenedUrl = Discourse.Model.extend({ + actionName: function() { + return I18n.t("admin.logs.screened_actions." + this.get('action')); + }.property('action') +}); + +Discourse.ScreenedUrl.reopenClass({ + findAll: function(filter) { + return Discourse.ajax("/admin/logs/screened_urls.json").then(function(screened_urls) { + return screened_urls.map(function(b) { + return Discourse.ScreenedUrl.create(b); + }); + }); + } +}); diff --git a/app/assets/javascripts/admin/routes/admin_logs_routes.js b/app/assets/javascripts/admin/routes/admin_logs_routes.js index da006a9861f..c14010109ed 100644 --- a/app/assets/javascripts/admin/routes/admin_logs_routes.js +++ b/app/assets/javascripts/admin/routes/admin_logs_routes.js @@ -12,24 +12,6 @@ Discourse.AdminLogsIndexRoute = Discourse.Route.extend({ } }); -/** - 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 staff actions that were logged. @@ -57,4 +39,40 @@ Discourse.AdminLogsStaffActionLogsRoute = Discourse.Route.extend({ // 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 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(); + } }); \ No newline at end of file diff --git a/app/assets/javascripts/admin/routes/admin_routes.js b/app/assets/javascripts/admin/routes/admin_routes.js index 4622f60954f..835b851dc4b 100644 --- a/app/assets/javascripts/admin/routes/admin_routes.js +++ b/app/assets/javascripts/admin/routes/admin_routes.js @@ -30,8 +30,9 @@ Discourse.Route.buildRoutes(function() { }); this.resource('adminLogs', { path: '/logs' }, function() { - this.route('screenedEmails', { path: '/screened_emails' }); this.route('staffActionLogs', { path: '/staff_action_logs' }); + this.route('screenedEmails', { path: '/screened_emails' }); + this.route('screenedUrls', { path: '/screened_urls' }); }); this.route('groups', {path: '/groups'}); diff --git a/app/assets/javascripts/admin/templates/logs.js.handlebars b/app/assets/javascripts/admin/templates/logs.js.handlebars index f18bf8cc5de..f1faac2b6f3 100644 --- a/app/assets/javascripts/admin/templates/logs.js.handlebars +++ b/app/assets/javascripts/admin/templates/logs.js.handlebars @@ -3,6 +3,7 @@
diff --git a/app/assets/javascripts/admin/templates/logs/screened_emails.js.handlebars b/app/assets/javascripts/admin/templates/logs/screened_emails.js.handlebars index 915eaf92f87..ec5c2d339a5 100644 --- a/app/assets/javascripts/admin/templates/logs/screened_emails.js.handlebars +++ b/app/assets/javascripts/admin/templates/logs/screened_emails.js.handlebars @@ -5,12 +5,12 @@ {{else}} {{#if model.length}} -{{i18n admin.logs.screened_urls.description}}
+ +{{#if loading}} +