ES6: Convert more routes over

This commit is contained in:
Robin Ward 2014-07-28 13:39:20 -04:00
parent bddffa7f9a
commit 5cd7e1b387
10 changed files with 15 additions and 70 deletions

View File

@ -1,12 +1,5 @@
/** export default Discourse.Route.extend({
Shows a list of all badges.
@class BadgesIndexRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.BadgesIndexRoute = Discourse.Route.extend({
model: function() { model: function() {
if (PreloadStore.get('badges')) { if (PreloadStore.get('badges')) {
return PreloadStore.getAndRemove('badges').then(function(json) { return PreloadStore.getAndRemove('badges').then(function(json) {

View File

@ -1,12 +1,4 @@
/** export default Ember.Route.extend({
Shows a particular badge.
@class BadgesShowRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.BadgesShowRoute = Ember.Route.extend({
serialize: function(model) { serialize: function(model) {
return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()}; return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()};
}, },

View File

@ -0,0 +1,5 @@
export default Discourse.Route.extend({
serialize: function() {
return "";
}
});

View File

@ -1,13 +0,0 @@
/**
Client-side pseudo-route for showing an error page.
@class ExceptionRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.ExceptionRoute = Discourse.Route.extend({
serialize: function() {
return "";
}
});

View File

@ -1,12 +1,4 @@
/** export default Discourse.Route.extend({
The route for the index of a Group
@class GroupIndexRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.GroupIndexRoute = Discourse.Route.extend({
model: function() { model: function() {
return this.modelFor('group').findPosts(); return this.modelFor('group').findPosts();
}, },

View File

@ -1,12 +1,4 @@
/** export default Discourse.Route.extend({
Set things up to display the members of a group
@class GroupMembersRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.GroupMembersRoute = Discourse.Route.extend({
model: function() { model: function() {
return this.modelFor('group'); return this.modelFor('group');
}, },

View File

@ -1,12 +1,4 @@
/** export default Discourse.Route.extend({
The base route for a group
@class GroupRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.GroupRoute = Discourse.Route.extend({
model: function(params) { model: function(params) {
return Discourse.Group.find(params.name); return Discourse.Group.find(params.name);

View File

@ -1,7 +1,7 @@
Discourse.LoginRoute = Discourse.Route.extend({ export default Discourse.Route.extend({
beforeModel: function() { beforeModel: function() {
if (!Discourse.SiteSetting.login_required) { if (!Discourse.SiteSetting.login_required) {
this.transitionTo('discovery.latest').then(function(e) { this.replaceWith('discovery.latest').then(function(e) {
Ember.run.next(function() { Ember.run.next(function() {
e.send('showLogin'); e.send('showLogin');
}); });

View File

@ -1,9 +1,9 @@
Discourse.SignupRoute = Discourse.Route.extend({ export default Discourse.Route.extend({
beforeModel: function() { beforeModel: function() {
this.transitionTo('discovery.latest').then(function(e) { this.replaceWith('discovery.latest').then(function(e) {
Ember.run.next(function() { Ember.run.next(function() {
e.send('showCreateAccount'); e.send('showCreateAccount');
}); });
}); });
} },
}); });

View File

@ -1,11 +1,3 @@
/**
View for showing a particular badge.
@class BadgesShowView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
export default Discourse.View.extend(Discourse.LoadMore, { export default Discourse.View.extend(Discourse.LoadMore, {
eyelineSelector: '.badge-user', eyelineSelector: '.badge-user',
tickOrX: function(field){ tickOrX: function(field){