diff --git a/app/assets/javascripts/discourse/routes/application_route.js b/app/assets/javascripts/discourse/routes/application.js.es6 similarity index 90% rename from app/assets/javascripts/discourse/routes/application_route.js rename to app/assets/javascripts/discourse/routes/application.js.es6 index 40b4648329a..c07b344e1a1 100644 --- a/app/assets/javascripts/discourse/routes/application_route.js +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -1,15 +1,6 @@ -/** - Application route for Discourse - - @class ApplicationRoute - @extends Ember.Route - @namespace Discourse - @module Discourse -**/ -Discourse.ApplicationRoute = Em.Route.extend({ +var ApplicationRoute = Em.Route.extend({ actions: { - error: function(err, transition) { if (err.status === 404) { // 404 @@ -106,14 +97,15 @@ Discourse.ApplicationRoute = Em.Route.extend({ } }, - activate: function() { + _activate: function() { this._super(); Em.run.next(function() { // Support for callbacks once the application has activated - Discourse.ApplicationRoute.trigger('activate'); + ApplicationRoute.trigger('activate'); }); } }); -RSVP.EventTarget.mixin(Discourse.ApplicationRoute); +RSVP.EventTarget.mixin(ApplicationRoute); +export default ApplicationRoute; diff --git a/app/assets/javascripts/discourse/routes/user_activity_route.js b/app/assets/javascripts/discourse/routes/user-activity.js.es6 similarity index 71% rename from app/assets/javascripts/discourse/routes/user_activity_route.js rename to app/assets/javascripts/discourse/routes/user-activity.js.es6 index 3e911d04b94..be81d645739 100644 --- a/app/assets/javascripts/discourse/routes/user_activity_route.js +++ b/app/assets/javascripts/discourse/routes/user-activity.js.es6 @@ -1,19 +1,9 @@ -/** - The base route for showing a user's activity - - @class UserActivityRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.UserActivityRoute = Discourse.Route.extend({ - +export default Discourse.Route.extend({ model: function() { return this.modelFor('user'); }, setupController: function(controller, user) { - this.controllerFor('user-activity').set('model', user); this.controllerFor('user').set('pmView', null); @@ -33,7 +23,4 @@ Discourse.UserActivityRoute = Discourse.Route.extend({ }); } } - }); - -Discourse.UserPrivateMessagesRoute = Discourse.UserActivityRoute.extend({}); diff --git a/app/assets/javascripts/discourse/routes/user_badges_route.js b/app/assets/javascripts/discourse/routes/user-badges.js.es6 similarity index 80% rename from app/assets/javascripts/discourse/routes/user_badges_route.js rename to app/assets/javascripts/discourse/routes/user-badges.js.es6 index b6717117fa1..cb2aa0c87be 100644 --- a/app/assets/javascripts/discourse/routes/user_badges_route.js +++ b/app/assets/javascripts/discourse/routes/user-badges.js.es6 @@ -1,11 +1,3 @@ -/** - This route shows a user's badges. - - @class UserBadgesRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.UserBadgesRoute = Discourse.Route.extend({ model: function() { return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true}); diff --git a/app/assets/javascripts/discourse/routes/user-index.js.es6 b/app/assets/javascripts/discourse/routes/user-index.js.es6 new file mode 100644 index 00000000000..d7d0c02d1d0 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-index.js.es6 @@ -0,0 +1,5 @@ +export default Em.Route.extend({ + redirect: function() { + this.replaceWith('userActivity', this.modelFor('user')); + } +}); diff --git a/app/assets/javascripts/discourse/routes/user_invited_route.js b/app/assets/javascripts/discourse/routes/user-invited.js.es6 similarity index 75% rename from app/assets/javascripts/discourse/routes/user_invited_route.js rename to app/assets/javascripts/discourse/routes/user-invited.js.es6 index aaa1a152a6b..7cb190aa79d 100644 --- a/app/assets/javascripts/discourse/routes/user_invited_route.js +++ b/app/assets/javascripts/discourse/routes/user-invited.js.es6 @@ -1,12 +1,4 @@ -/** - This route shows who a user has invited - - @class UserInvitedRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.UserInvitedRoute = Discourse.Route.extend({ +export default Discourse.Route.extend({ renderTemplate: function() { this.render({ into: 'user', outlet: 'userOutlet' }); }, @@ -26,12 +18,6 @@ Discourse.UserInvitedRoute = Discourse.Route.extend({ }, actions: { - - /** - Shows the invite modal to invite users to the forum. - - @method showInvite - **/ showInvite: function() { Discourse.Route.showModal(this, 'invite', Discourse.User.current()); this.controllerFor('invite').reset(); @@ -45,5 +31,4 @@ Discourse.UserInvitedRoute = Discourse.Route.extend({ bootbox.alert(I18n.t("user.invited.bulk_invite.error", { filename: filename, message: message })); } } - }); diff --git a/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 new file mode 100644 index 00000000000..b3103444a9e --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 @@ -0,0 +1,3 @@ +import UserActivityRoute from 'discourse/routes/user-activity'; + +export default UserActivityRoute.extend(); diff --git a/app/assets/javascripts/discourse/routes/user_route.js b/app/assets/javascripts/discourse/routes/user.js.es6 similarity index 90% rename from app/assets/javascripts/discourse/routes/user_route.js rename to app/assets/javascripts/discourse/routes/user.js.es6 index 7df3be76efc..3bcd085acc7 100644 --- a/app/assets/javascripts/discourse/routes/user_route.js +++ b/app/assets/javascripts/discourse/routes/user.js.es6 @@ -1,12 +1,4 @@ -/** - Handles routes related to users. - - @class UserRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.UserRoute = Discourse.Route.extend({ +export default Discourse.Route.extend({ actions: { logout: function() { diff --git a/app/assets/javascripts/discourse/routes/user_index_route.js b/app/assets/javascripts/discourse/routes/user_index_route.js deleted file mode 100644 index 4da319539d9..00000000000 --- a/app/assets/javascripts/discourse/routes/user_index_route.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - If we request /users/eviltrout without a sub route. - - @class UserIndexRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.UserIndexRoute = Discourse.UserActivityRoute.extend({ - redirect: function() { - this.replaceWith('userActivity', this.modelFor('user')); - } -});