From 92f97fa94f80febc9accec576b58673b6dc78378 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 26 Jun 2015 13:07:56 -0400 Subject: [PATCH] Upgrade topics to modern ES6 --- .../controllers/discovery/topics.js.es6 | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index b5c521c86d8..a69daece73e 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -2,7 +2,7 @@ import DiscoveryController from 'discourse/controllers/discovery'; import { queryParams } from 'discourse/controllers/discovery-sortable'; import BulkTopicSelection from 'discourse/mixins/bulk-topic-selection'; -var controllerOpts = { +const controllerOpts = { needs: ['discovery'], period: null, @@ -24,10 +24,10 @@ var controllerOpts = { actions: { - changeSort: function(sortBy) { + changeSort(sortBy) { if (this.get('isSearch')) { - var term = this.get('searchTerm'); - var order; + let term = this.get('searchTerm'); + let order; if (sortBy === 'activity') { order = 'latest'; } if (sortBy === 'views') { order = 'views'; } @@ -51,7 +51,7 @@ var controllerOpts = { // Show newly inserted topics showInserted: function() { - var tracker = Discourse.TopicTrackingState.current(); + const tracker = Discourse.TopicTrackingState.current(); // Move inserted into topics this.get('content').loadBefore(tracker.get('newIncoming')); @@ -60,7 +60,7 @@ var controllerOpts = { }, refresh: function() { - var filter = this.get('model.filter'), + const filter = this.get('model.filter'), self = this; this.setProperties({ order: 'default', ascending: false }); @@ -79,7 +79,7 @@ var controllerOpts = { self.setProperties({ model: list }); self.resetSelected(); - var tracking = Discourse.TopicTrackingState.current(); + const tracking = Discourse.TopicTrackingState.current(); if (tracking) { tracking.sync(list, filter); } @@ -90,7 +90,7 @@ var controllerOpts = { resetNew: function() { - var self = this; + const self = this; Discourse.TopicTrackingState.current().resetNew(); Discourse.Topic.resetNew().then(function() { @@ -135,11 +135,11 @@ var controllerOpts = { footerMessage: function() { if (!this.get('allLoaded')) { return; } - var category = this.get('category'); + const category = this.get('category'); if( category ) { return I18n.t('topics.bottom.category', {category: category.get('name')}); } else { - var split = (this.get('model.filter') || '').split('/'); + const split = (this.get('model.filter') || '').split('/'); if (this.get('model.topics.length') === 0) { return I18n.t("topics.none." + split[0], { category: split[1] @@ -155,7 +155,7 @@ var controllerOpts = { footerEducation: function() { if (!this.get('allLoaded') || this.get('model.topics.length') > 0 || !Discourse.User.current()) { return; } - var split = (this.get('model.filter') || '').split('/'); + const split = (this.get('model.filter') || '').split('/'); if (split[0] !== 'new' && split[0] !== 'unread') { return; }