Upgrade topics to modern ES6
This commit is contained in:
parent
9cf77bc01d
commit
92f97fa94f
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue