ES6: More controllers converted over

This commit is contained in:
Robin Ward 2014-08-12 18:26:53 -04:00
parent 6d919d75cc
commit 1c9ccc6eb1
7 changed files with 13 additions and 31 deletions

View File

@ -1,4 +1,4 @@
Discourse.DiscoverySortableController = Discourse.Controller.extend({ export default Discourse.Controller.extend({
needs: ['discovery/topics'], needs: ['discovery/topics'],
queryParams: ['order', 'ascending', 'status', 'state', 'search'], queryParams: ['order', 'ascending', 'status', 'state', 'search'],
order: Em.computed.alias('controllers.discovery/topics.order'), order: Em.computed.alias('controllers.discovery/topics.order'),

View File

@ -1,12 +1,4 @@
/** export default Discourse.ObjectController.extend({
The base controller for discoverying topics
@class DiscoveryController
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
Discourse.DiscoveryController = Discourse.ObjectController.extend({
loading: false, loading: false,
loadingSpinner: false, loadingSpinner: false,
scheduledSpinner: null, scheduledSpinner: null,
@ -25,4 +17,3 @@ Discourse.DiscoveryController = Discourse.ObjectController.extend({
showMoreMonthlyUrl: function() { return this.showMoreUrl('monthly'); }.property('category', 'noSubcategories'), showMoreMonthlyUrl: function() { return this.showMoreUrl('monthly'); }.property('category', 'noSubcategories'),
showMoreYearlyUrl: function() { return this.showMoreUrl('yearly'); }.property('category', 'noSubcategories') showMoreYearlyUrl: function() { return this.showMoreUrl('yearly'); }.property('category', 'noSubcategories')
}); });

View File

@ -1,4 +1,6 @@
export default Discourse.DiscoveryController.extend({ import DiscoveryController from 'discourse/controllers/discovery';
export default DiscoveryController.extend({
needs: ['modal', 'discovery'], needs: ['modal', 'discovery'],
withLogo: Em.computed.filterBy('categories', 'logo_url'), withLogo: Em.computed.filterBy('categories', 'logo_url'),

View File

@ -1,12 +1,6 @@
/** import DiscoveryController from 'discourse/controllers/discovery';
The controller for discoverying 'Top' topics
@class DiscoveryTopController export default DiscoveryController.extend({
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
export default Discourse.DiscoveryController.extend({
needs: ['discovery'], needs: ['discovery'],
actions: { actions: {

View File

@ -1,12 +1,6 @@
/** import DiscoveryController from 'discourse/controllers/discovery';
The controller for displaying a list of topics.
@class DiscoveryTopicsController export default DiscoveryController.extend({
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
export default Discourse.DiscoveryController.extend({
needs: ['discovery'], needs: ['discovery'],
bulkSelectEnabled: false, bulkSelectEnabled: false,
selected: [], selected: [],

View File

@ -1,4 +1,4 @@
Discourse.TopicController = Discourse.ObjectController.extend(Discourse.SelectedPostsCount, { export default Discourse.ObjectController.extend(Discourse.SelectedPostsCount, {
multiSelect: false, multiSelect: false,
needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress'], needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress'],
allPostsSelected: false, allPostsSelected: false,

View File

@ -1,5 +1,6 @@
import buildCategoryRoute from 'discourse/routes/build-category-route'; import buildCategoryRoute from 'discourse/routes/build-category-route';
import buildTopicRoute from 'discourse/routes/build-topic-route'; import buildTopicRoute from 'discourse/routes/build-topic-route';
import DiscoverySortableController from 'discourse/controllers/discovery-sortable';
export default { export default {
name: 'dynamic-route-builders', name: 'dynamic-route-builders',
@ -11,14 +12,14 @@ export default {
app.DiscoveryCategoryNoneRoute = buildCategoryRoute('latest', {no_subcategories: true}); app.DiscoveryCategoryNoneRoute = buildCategoryRoute('latest', {no_subcategories: true});
Discourse.Site.currentProp('filters').forEach(function(filter) { Discourse.Site.currentProp('filters').forEach(function(filter) {
app["Discovery" + filter.capitalize() + "Controller"] = Discourse.DiscoverySortableController.extend(); app["Discovery" + filter.capitalize() + "Controller"] = DiscoverySortableController.extend();
app["Discovery" + filter.capitalize() + "Route"] = buildTopicRoute(filter); app["Discovery" + filter.capitalize() + "Route"] = buildTopicRoute(filter);
app["Discovery" + filter.capitalize() + "CategoryRoute"] = buildCategoryRoute(filter); app["Discovery" + filter.capitalize() + "CategoryRoute"] = buildCategoryRoute(filter);
app["Discovery" + filter.capitalize() + "CategoryNoneRoute"] = buildCategoryRoute(filter, {no_subcategories: true}); app["Discovery" + filter.capitalize() + "CategoryNoneRoute"] = buildCategoryRoute(filter, {no_subcategories: true});
}); });
Discourse.Site.currentProp('periods').forEach(function(period) { Discourse.Site.currentProp('periods').forEach(function(period) {
app["DiscoveryTop" + period.capitalize() + "Controller"] = Discourse.DiscoverySortableController.extend(); app["DiscoveryTop" + period.capitalize() + "Controller"] = DiscoverySortableController.extend();
app["DiscoveryTop" + period.capitalize() + "Route"] = buildTopicRoute('top/' + period); app["DiscoveryTop" + period.capitalize() + "Route"] = buildTopicRoute('top/' + period);
app["DiscoveryTop" + period.capitalize() + "CategoryRoute"] = buildCategoryRoute('top/' + period); app["DiscoveryTop" + period.capitalize() + "CategoryRoute"] = buildCategoryRoute('top/' + period);
app["DiscoveryTop" + period.capitalize() + "CategoryNoneRoute"] = buildCategoryRoute('top/' + period, {no_subcategories: true}); app["DiscoveryTop" + period.capitalize() + "CategoryNoneRoute"] = buildCategoryRoute('top/' + period, {no_subcategories: true});