diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 index 108cb74f3a6..6912115e1ec 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 @@ -1,18 +1,17 @@ export default Ember.Controller.extend({ actions: { - refresh: function() { - var model = this.get('model'), - self = this; + refresh() { + const model = this.get('model'); self.set('loading', true); - Discourse.EmailPreview.findDigest(this.get('lastSeen')).then(function (email) { + Discourse.EmailPreview.findDigest(this.get('lastSeen')).then(email => { model.setProperties(email.getProperties('html_content', 'text_content')); - self.set('loading', false); + this.set('loading', false); }); }, - toggleShowHtml: function() { + toggleShowHtml() { this.toggleProperty('showHtml'); } } diff --git a/app/assets/javascripts/admin/routes/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/routes/admin-email-preview-digest.js.es6 new file mode 100644 index 00000000000..94d48e400df --- /dev/null +++ b/app/assets/javascripts/admin/routes/admin-email-preview-digest.js.es6 @@ -0,0 +1,16 @@ +export default Discourse.Route.extend({ + + model() { + return Discourse.EmailPreview.findDigest(); + }, + + afterModel(model) { + const controller = this.controllerFor('adminEmailPreviewDigest'); + controller.setProperties({ + model: model, + lastSeen: moment().subtract(7, 'days').format('YYYY-MM-DD'), + showHtml: true + }); + } + +}); diff --git a/app/assets/javascripts/admin/routes/admin_email_preview_digest_route.js b/app/assets/javascripts/admin/routes/admin_email_preview_digest_route.js deleted file mode 100644 index 511b56bbfec..00000000000 --- a/app/assets/javascripts/admin/routes/admin_email_preview_digest_route.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - Previews the Email Digests - - @class AdminEmailPreviewDigest - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ - -Discourse.AdminEmailPreviewDigestRoute = Discourse.Route.extend({ - - model: function() { - return Discourse.EmailPreview.findDigest(); - }, - - afterModel: function(model) { - var controller = this.controllerFor('adminEmailPreviewDigest'); - controller.setProperties({ - model: model, - lastSeen: moment().subtract(7, 'days').format('YYYY-MM-DD'), - showHtml: true - }); - } - -}); diff --git a/app/assets/javascripts/admin/templates/email_preview_digest.hbs b/app/assets/javascripts/admin/templates/email_preview_digest.hbs index 7670d6194b4..6d95eb0666f 100644 --- a/app/assets/javascripts/admin/templates/email_preview_digest.hbs +++ b/app/assets/javascripts/admin/templates/email_preview_digest.hbs @@ -4,24 +4,22 @@
{{{text_content}}}+
{{{model.text_content}}}{{/if}} {{/conditional-loading-spinner}}