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 @@
/**
Shows a list of all badges.
export default Discourse.Route.extend({
@class BadgesIndexRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.BadgesIndexRoute = Discourse.Route.extend({
model: function() {
if (PreloadStore.get('badges')) {
return PreloadStore.getAndRemove('badges').then(function(json) {

View File

@ -1,12 +1,4 @@
/**
Shows a particular badge.
@class BadgesShowRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.BadgesShowRoute = Ember.Route.extend({
export default Ember.Route.extend({
serialize: function(model) {
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 @@
/**
The route for the index of a Group
@class GroupIndexRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.GroupIndexRoute = Discourse.Route.extend({
export default Discourse.Route.extend({
model: function() {
return this.modelFor('group').findPosts();
},

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
Discourse.SignupRoute = Discourse.Route.extend({
export default Discourse.Route.extend({
beforeModel: function() {
this.transitionTo('discovery.latest').then(function(e) {
this.replaceWith('discovery.latest').then(function(e) {
Ember.run.next(function() {
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, {
eyelineSelector: '.badge-user',
tickOrX: function(field){