mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
ES6: Convert more routes over
This commit is contained in:
parent
bddffa7f9a
commit
5cd7e1b387
@ -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) {
|
@ -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()};
|
||||||
},
|
},
|
5
app/assets/javascripts/discourse/routes/exception.js.es6
Normal file
5
app/assets/javascripts/discourse/routes/exception.js.es6
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default Discourse.Route.extend({
|
||||||
|
serialize: function() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
@ -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 "";
|
|
||||||
}
|
|
||||||
});
|
|
@ -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();
|
||||||
},
|
},
|
@ -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');
|
||||||
},
|
},
|
@ -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);
|
@ -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');
|
||||||
});
|
});
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user